Welcome Guest, Not a member yet? Register   Sign In
WHY RETURN 0?
#1

[eluser]Unknown[/eluser]
this query returns num_rows=0, and in my phpadmin, this query returns 1, when password='123' and username='adolf'. any idea?

$query = $this->db->query("select tipo.tipo
from tipo,persona
where tipo.id_tipo=persona.id_tipo
and persona.password='.$password.'
and '.$username.' = persona.rut"
);

echo $query->num_rows;
#2

[eluser]InsiteFX[/eluser]
Code:
echo $query->num_rows();
#3

[eluser]Unknown[/eluser]
Solution: Just add " " to php variable.

$query = $this->db->query(“select tipo.tipo
from tipo,persona
where tipo.id_tipo=persona.id_tipo
and persona.password=’.$password.’
and "‘.$username.’" = persona.rut”
);

echo $query->num_rows();





Theme © iAndrew 2016 - Forum software by © MyBB