Here is some code:
Model:
class Project extends AppModel {
var $name = 'Project';
var $primaryKey = 'project_id';
function customFunction($id=0){
$sql = "custom sql... where project_id = ?";
$params = array( customValidation($id) );
return $this->query($sql, $params, false);
}
}
Controller:
class ProjectsController extends AppController {
var $name = 'Projects';
function test($id=0){
$this->data = $this->Project->testByID($id);
}
}
View:
echo $form->create("Project");
echo $form->input('project_name');
echo $form->end();
ISSUE:
The controller's action with the custom SQL doesn't populate the form.
I figured out that It's due to the array not being in the proper
format:
Custom query: Array ( [0] => Array (...)
CakePHP built in actions (ie. read() ): Array ( [Project] => Array
(...)
Is there a way to have the custom SQL be returned in the proper format
and populate the form?
Check out the new CakePHP Questions site http://cakeqs.org and help others with
their CakePHP related questions.
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en