xiao Posted April 20, 2008 Share Posted April 20, 2008 Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in... I call it like this: if(mysql_num_rows(mysql_query($qryBehuizing)) == 0){ echo "<option>Geen producten gevonden</option>"; }else{ Query: $qryBehuizing = mysql_query("SELECT p.products_id, p.products_model, p.products_price, p.products_image, pd.products_name, pc.categories_id FROM products p, products_description pd, products_to_categories pc WHERE pc.categories_id = '".$instBC."' AND p.products_id = pd.products_id AND p.products_id = pc.products_id AND pd.language_id = '".$instT."' AND p.products_price <=50 GROUP BY pd.products_name ORDER BY p.products_price") or die(mysql_error()); What am I doing wrong? Link to comment https://forums.phpfreaks.com/topic/101992-solved-mysql_num_rows-supplied-argument-is-not-a-valid-mysql-result/ Share on other sites More sharing options...
AndyB Posted April 20, 2008 Share Posted April 20, 2008 You could start by unbundling your code so it gives better information: $qryBehuizing = " ... whatever ..."; $result = mysql_query($qryBehuizing) or die("Error ". mysql_error(). " with query ". $qryBehuizing); if (mysql_num_rows($result) == 0) { // etc } Link to comment https://forums.phpfreaks.com/topic/101992-solved-mysql_num_rows-supplied-argument-is-not-a-valid-mysql-result/#findComment-521956 Share on other sites More sharing options...
xiao Posted April 20, 2008 Author Share Posted April 20, 2008 Didn't think that far It says: Error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Resource id #6' at line 1 with query Resource id #6 Link to comment https://forums.phpfreaks.com/topic/101992-solved-mysql_num_rows-supplied-argument-is-not-a-valid-mysql-result/#findComment-521959 Share on other sites More sharing options...
xiao Posted April 20, 2008 Author Share Posted April 20, 2008 In phpMyAdmin I get this error when inserting the query: #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"SELECT p.products_id, p.products_model, p.products_price, p.products_image, pd.' at line 1 Link to comment https://forums.phpfreaks.com/topic/101992-solved-mysql_num_rows-supplied-argument-is-not-a-valid-mysql-result/#findComment-521977 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.