• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Newbie at Codeigniter with Login Model

Hi , every one , well , this is first time i use a framework , Friends recommanded me CodeIgniter , that i found very usefull !
well i have problem with the mysql_nu_rows i didn't find an equivalent in Db librairy
please help me solving this problem , i need to uses it here
* To change this template, choose Tools | Templates
* and open the template in the editor.
class login_model extends CI_Model{
    public function verify_login($name,$pass){
      $query= $this->db->get_where('ci_users', array('name' => $name,
                                              'pass' =>$pass
         return 1;
             return 0;
please tell me if i have anything wrong !
i have always 0 as value of return wich means count_all is null
of course with correct login name and pass

Welcome to the Forums!
The reason for your problem is that you are not returning the results.
What you should be using is:
if($query->num_rows() == 1)
  return $query->row();
  return FALSE;
Of course you can use result(), result_array() etc. whichever suits your needs.
You should check the documentation for generating query results.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.