$query->num_rows nothing returns |
Within my model I have the following code but does not return anything (running the sql in the bank returns the record).
I also tried with $ query-> num_rows also, same thing ... what's wrong? Code: <?php (07-20-2015, 07:05 PM)mlfgo Wrote: Within my model I have the following code but does not return anything (running the sql in the bank returns the record). Maybe you should add value for "FALSE" logic. Like this : if($query->num_rows() > 0){ //code if result not empty }else{ return FALSE; }
As I see, your field name in the table is `Usuario`. But when you call it, you do it with 'usuario'.
Website: http://avenir.ro
If it's true that your table name is in lower case and the fields are in firstcaps, then the next question is: do you really want to look for records that literally hold the values 'user' and 'password', or - which is more likely - do you want to get records that match a certain combination of username and password?
In that case, your query should look like this: PHP Code: $query = $this->db->query("SELECT * FROM `usuario` WHERE `Usuario` = '$user' AND `Senha` = '$password'");
Thanks friends.
Remodeling the question, the instruction Code: $query->num_rows; is some setting? (07-22-2015, 05:15 AM)mlfgo Wrote: Thanks friends. There's a difference between $this->num_rows and $this->num_rows() ... you should use the latter. |
Welcome Guest, Not a member yet? Register Sign In |