I have a function that retrieve some data from table and echo it. The function is...
function myfunction(){
global $db,$con;
$qry = "SELECT field1 FROM tbl ORDER BY fieldId ASC";
mysql_select_db($db,$con);
$qry_res = mysql_query($qry,$con);
$numRow = mysql_num_rows($qry_res);
if($numRow > 0){
while ($res = mysql_fetch_array($qry_res)) {
echo '$res['field1']';
}
} else {
echo 'nothing found';
}
}
My table is not empty.
the above function is giving an warning Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\iktt\app\_include\db\functions.php on line 70
Could not find the problem. What should I do ?