我想編輯行。視圖文件包含帶有Ajax的dropwons。 我用$ this-> data = $ this-> CourseBuilding-> read(null,$ id);但它不能讀取該ID的所有字段。在cakephp中讀取功能問題(不能讀取所有字段)
你能幫助我嗎?
我想編輯行。視圖文件包含帶有Ajax的dropwons。 我用$ this-> data = $ this-> CourseBuilding-> read(null,$ id);但它不能讀取該ID的所有字段。在cakephp中讀取功能問題(不能讀取所有字段)
你能幫助我嗎?
通ID到URL名稱ID
那麼當retrive數據使用$id=$this->params['id'];
和
$this->Your model name->id = $id;
$this->data = $this->Your model name->read();
你也會收到您的數據
感謝 MEHUL
從http://api.cakephp.org/class/model#method-Modelread - 你可以把你想要的所有字段作爲參數傳遞給read方法是這樣的:
$this->CourseBuilding->read(array('field1', 'field2', ...), $id);
,或者您可以使用它代替:
$this->CourseBuilding->findById($id);
$this->CourseBuilding->read('*',$id);
通過使用*作爲第一read方法的參數將返回該模型的所有字段。