Issue
How can i write this syntax in CakePHP:
Example:
$userID = "SELECT user_id FROM customers WHERE phone = '88888888' ";
like:
$user = $this->Customer->find('first', array('conditions' => array(
'Customer.user_id WHERE phone' => '88888888')));
I would like to find user_id where the phone number have a specific value
Solution
What you're trying to do is really basic, you should read the documentation for the find()
function.
$user = $this->Customer->find('first', array(
// You specify which field(s) you want
'fields' => array('user_id'),
// You add the condition(s)
'conditions' => array('Customer.phone' => '88888888'),
));
Answered By - SamHecquet
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.