Reputation:
code
$records = $this->User->find('all', array(
'conditions' => array('User.email' => '[email protected]')));
database
database fields(id,username,email,img_name,password)
table name is signup
This is my select query..using find all in cakephp..the query is running fine.
Under this i want to access the row in the database where email='[email protected].
it is clearly defined above and easily understood by cakephp users. I'm new to cakephp right now.
Just tell me how to display the data which is stored in the record variable, coz record is returning an array,,when i print $record then the output is "Array"... Your replies are mostly welcome. ....Thankyou.....
Upvotes: 0
Views: 1932
Reputation: 8476
cakephp find('all')
will return array like this
Array
(
[0] => Array
(
[ModelName] => Array
(
[id] => 83
[field1] => value1
[field2] => value2
[field3] => value3
)
[AssociatedModelName] => Array
(
[id] => 1
[field1] => value1
[field2] => value2
[field3] => value3
)
)
)
so you need to access it like $records[0]['User']['email'], $records[1]['User']['email']... $records[key]['User']['email']
also
foreach ($records as $k => $v) {
echo $v['User']['email'];
}
Upvotes: 2