narjis Posted June 23, 2011 Share Posted June 23, 2011 why does my mysql_num_rows always give the same err Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\wamp2\www\e_commerce\e_commerce\admin\viewProducts.php on line 8 $conn= mysql_connect("localhost","root",""); mysql_select_db("ecommerce",$conn); $product_list=""; $sql = "SELECT * FORM products"; $query = mysql_query($sql,$conn); $exist = mysql_num_rows($query); although the very same code is running fine in another file of the same project. Please help me. Quote Link to comment https://forums.phpfreaks.com/topic/240261-mysql_num_rows-error/ Share on other sites More sharing options...
Pikachu2000 Posted June 23, 2011 Share Posted June 23, 2011 Because the query is failing. Read the query string carefully, looking for misspellings. Quote Link to comment https://forums.phpfreaks.com/topic/240261-mysql_num_rows-error/#findComment-1234096 Share on other sites More sharing options...
fugix Posted June 23, 2011 Share Posted June 23, 2011 If you pasted that code from your editor, you have mispelled FROM here $sql = "SELECT * FORM products"; Quote Link to comment https://forums.phpfreaks.com/topic/240261-mysql_num_rows-error/#findComment-1234098 Share on other sites More sharing options...
colap Posted June 24, 2011 Share Posted June 24, 2011 why does my mysql_num_rows always give the same err Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\wamp2\www\e_commerce\e_commerce\admin\viewProducts.php on line 8 $conn= mysql_connect("localhost","root",""); mysql_select_db("ecommerce",$conn); $product_list=""; $sql = "SELECT * FORM products"; $query = mysql_query($sql,$conn); $exist = mysql_num_rows($query); although the very same code is running fine in another file of the same project. Please help me. So what was the error ? Quote Link to comment https://forums.phpfreaks.com/topic/240261-mysql_num_rows-error/#findComment-1234318 Share on other sites More sharing options...
Nuv Posted June 24, 2011 Share Posted June 24, 2011 $sql = "SELECT * FORM products"; Its FROM not FORM. although OP already realised his mistake, this was for php-coder. Quote Link to comment https://forums.phpfreaks.com/topic/240261-mysql_num_rows-error/#findComment-1234328 Share on other sites More sharing options...
fugix Posted June 24, 2011 Share Posted June 24, 2011 $sql = "SELECT * FORM products"; Its FROM not FORM. although OP already realised his mistake, this was for php-coder. I've already stated this Quote Link to comment https://forums.phpfreaks.com/topic/240261-mysql_num_rows-error/#findComment-1234330 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.