开发者

read function problem (not read all fields) in cakephp

i want to edit row. view file contains dropwons with Ajax. i used $this->data = $this->CourseBuilding->read(nu开发者_Go百科ll, $id); but it cant read all fields of that id.

Can U help me.


From http://api.cakephp.org/class/model#method-Modelread - you can pass all the fields you want as a parameter to the read method like this:

$this->CourseBuilding->read(array('field1', 'field2', ...), $id);

or you can use this instead:

$this->CourseBuilding->findById($id);


$this->CourseBuilding->read('*',$id);

By using * as the first argument of the read method will return all the fields of that model.


pass id to url name id

then when retrive data use $id=$this->params['id'];

and

$this->Your model name->id = $id;

$this->data = $this->Your model name->read();

U will receive your data

Thanks Mehul

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜