2010-04-29 85 views

回答

0

如果它在數據庫中,當你到達下一個表單時,只需在控制器中再次讀出它並將其設置爲視圖變量。

$this->set('lastid', $this->Model->read(null,$id)); 

或者,如果您需要在數據庫中搜索現場使用發現

$this->set('lastid', $this->Model->find('first', array('conditions'=>array('username'=>'MyUserName')) , array('id'))); 

你可以去周圍使用mysql_insert_id()

+0

謝謝!很簡單,我在想太多。 – junior29101 2010-04-29 21:32:29

+0

我不會使用mysql_insert_id()。它不是便攜式的,上班時會很笨重。假設您甚至可以從ConnectionManager獲取連接資源。 – 2010-04-29 21:51:03