• support@answerspoint.com

count no of rows in cakephp base on email id

685

when i count no of rows in php i do like that

$sql=mysql_query("select * from users where username='$email'") or die("select error".mysql_query());

   $no_rows=mysql_num_rows($sql);

but i dont know how to do it in cake php and my data is coming this from

[User] => Array
    (
        [first_name] => arjun
        [last_name] => tyagi
        [username] => arjun@gmail.com
        [phone_no] => 9569908024
        [mobile_no] => 9569908024
        [state_id] => 2
        [location_id] => 15
        [password] => cffa41a028807034b54b5849d5f4d3ca7532e701
        [confirm_password] => 12345
    )

 

1Answer


0
$totalUsers = $this->User->find('count', array('conditions'=>array('User.email' => $email)));

but that is actually pretty well documented: http://book.cakephp.org/2.0/en/models/retrieving-your-data.html

  • answered 2 years ago
  • Gul Hafiz

Your Answer

    Facebook Share