ras Posted February 20, 2006 Posted February 20, 2006 i instaled some contributions but dont know wich one is giving me this problem as i didn have to edit my products for a while now. the error shows up when i edit my products. at the top of the page i get this Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/myfung/public_html/admin/includes/functions/database.php on line 99 Warning: reset(): Passed variable is not an array or object in /home/myfung/public_html/admin/includes/classes/object_info.php on line 17 Warning: Variable passed to each() is not an array or object in /home/myfung/public_html/admin/includes/classes/object_info.php on line 18 where should i look? i chaked the database.php line 99 have this code : return mysql_fetch_array($db_query, MYSQL_ASSOC); and this is the code for object_info.php on line 17 , 18 reset($object_array); while (list($key, $value) = each($object_array)) { thanks Quote
Guest Posted February 20, 2006 Posted February 20, 2006 (edited) it is saying that $db_query isn't a valid resouce. mysql_fetch_array() takes the result from a mysql query statement. See what $db_query contains it should be somthing like $db_query = tep_db_query("select ....") or $db_query = mysql_query("select ....") $db_query then contains a resouce id. The chances are you have just fed the sql query string into mysql_fetch_array to sum up:- Wrong $db_query = "select ..."; return mysql_fetch_array($db_query, MYSQL_ASSOC); Right $db_query = tep_db_query("select ..."); return mysql_fetch_array($db_query, MYSQL_ASSOC); Because this will give an error reset() and each() will give errors becuase they have to be arrays. Have a look just before the reset to see what builds $object_array Hope this helps Sam Edited February 20, 2006 by Nimmit Quote
ras Posted February 20, 2006 Author Posted February 20, 2006 it is saying that $db_query isn't a valid resouce. mysql_fetch_array() takes the result from a mysql query statement. See what $db_query contains it should be somthing like $db_query = tep_db_query("select ....") or $db_query = mysql_query("select ....") $db_query then contains a resouce id. The chances are you have just fed the sql query string into mysql_fetch_array to sum up:- Wrong $db_query = "select ..."; return mysql_fetch_array($db_query, MYSQL_ASSOC); Right $db_query = tep_db_query("select ..."); return mysql_fetch_array($db_query, MYSQL_ASSOC); Because this will give an error reset() and each() will give errors becuase they have to be arrays. Have a look just before the reset to see what builds $object_array Hope this helps Sam you are right $db_query = tep_db_query("select ....") or $db_query = mysql_query("select ....") but i dont have those lines in my code Quote
Guest Posted February 20, 2006 Posted February 20, 2006 if you can see $db_query = "select ..." change it to $db_query = tep_db_query("select...") Quote
ras Posted February 20, 2006 Author Posted February 20, 2006 if you can see $db_query = "select ..." change it to $db_query = tep_db_query("select...") i dont have $db_query = in my code Quote
ras Posted February 20, 2006 Author Posted February 20, 2006 i dont have $db_query = in my code i fixed it found some mistakes from gift add contribution. thanks Quote
krobinson Posted September 25, 2006 Posted September 25, 2006 I am having the same problem - I get this error while editing/adding products (catagories.php)- Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in c:\catalog\admin\includes\functions\database.php on line 99 Here are the lines in database.php function tep_db_fetch_array($db_query) { return mysql_fetch_array($db_query, MYSQL_ASSOC); - this is line 99 I don't have any other errors, & the error goes away when I put the @ at the front of line 99 - however I do not know exactly what putting the @ does & if I want the error to go away or if it is something I need to find & fix. If anyone has any ideas please let me know. Thanks, Kristine www.boxgeek.com Quote Kristine
supernoc Posted December 21, 2006 Posted December 21, 2006 I am having the same problem - I get this error while editing/adding products (catagories.php)- Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in c:\catalog\admin\includes\functions\database.php on line 99 Here are the lines in database.php function tep_db_fetch_array($db_query) { return mysql_fetch_array($db_query, MYSQL_ASSOC); - this is line 99 I don't have any other errors, & the error goes away when I put the @ at the front of line 99 - however I do not know exactly what putting the @ does & if I want the error to go away or if it is something I need to find & fix. If anyone has any ideas please let me know. Thanks, Kristine www.boxgeek.com Responding for future searches. I have found this specific error mostly with incorrect or missing code in admin\includes\classes\order.php, I recommend having a copy of your current store's files along with a copy of default install oscommerce files, and using a compare program like Beyond Compare Quote
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.
Note: Your post will require moderator approval before it will be visible.