louis_coetzee Posted September 3, 2009 Share Posted September 3, 2009 Hi, I get the error: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\wamp\www\eliteacc\lib\database.php on line 45 # Finds one product by id. # Returns Array. function find_listing($id) { db_connect(); $query = sprintf("SELECT * FROM listing where listing.id = '%s'", mysql_real_escape_string($id)); $result = mysql_query($query); $row = mysql_fetch_array($result); return $row; } Link to comment https://forums.phpfreaks.com/topic/172945-warning-mysql_fetch_array-supplied-argument-is-not-a-valid-mysql-result-reso/ Share on other sites More sharing options...
Zyx Posted September 3, 2009 Share Posted September 3, 2009 You have an error in the query and mysql_query() returned false instead of result resource. Use MySQL error reporting functions to get to know more. Link to comment https://forums.phpfreaks.com/topic/172945-warning-mysql_fetch_array-supplied-argument-is-not-a-valid-mysql-result-reso/#findComment-911493 Share on other sites More sharing options...
louis_coetzee Posted September 3, 2009 Author Share Posted September 3, 2009 You have an error in the query and mysql_query() returned false instead of result resource. Use MySQL error reporting functions to get to know more. Thanks, stupid mistake in query. Solved. Link to comment https://forums.phpfreaks.com/topic/172945-warning-mysql_fetch_array-supplied-argument-is-not-a-valid-mysql-result-reso/#findComment-911495 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.