PHP mysql_fetch does not return values

Posted by Petr on Stack Overflow See other posts from Stack Overflow or by Petr
Published on 2010-05-27T06:01:34Z Indexed on 2010/05/27 6:11 UTC
Read the original article Hit count: 145

Filed under:
|

Hi, Being quite new with PHP, I cannot find any solution why this does not work. The query is OK and the resource is returned. But I dunno why fetch_assoc does not print values. Thanks

$query=sprintf("SELECT ID,NAME FROM USERS WHERE PASS='%s' AND NAME='%s'",mysql_real_escape_string($p),mysql_real_escape_string($n));

$result=mysql_query($query);

if ($result)
 {

while ($row = mysql_fetch_assoc($result)) {
    echo $row['ID'];
    echo $row['NAME'];
}
}

}

© Stack Overflow or respective owner

Related posts about php

Related posts about mysql