views:

40

answers:

2

hi all, i want to edit row. view file contains dropwons with Ajax. i used $this->data = $this->CourseBuilding->read(null, $id); but it cant read all fields of that id.

Can U help me.

A: 

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

Mehul Panchal
+1  A: 

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);
al3cs