akent64 Posted June 6, 2007 Share Posted June 6, 2007 (edited) After including the sort order contribution for product attributes I seem to have the following error at the top of a page when I click on a product: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /var/www/html/oscommerce/includes/functions/database.php on line 99 This error means that the product cannot found for some reason even though it is there?! Any help would be greatly appreciated Thanks Andy Edited June 6, 2007 by akent64 Quote Link to comment Share on other sites More sharing options...
djmonkey1 Posted June 6, 2007 Share Posted June 6, 2007 After including the sort order contribution for product attributes I seem to have the following error at the top of a page when I click on a product: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /var/www/html/oscommerce/includes/functions/database.php on line 99 This error means that the product cannot found for some reason even though it is there?! Any help would be greatly appreciated Thanks Andy What code is found in and around /var/www/html/oscommerce/includes/functions/database.php on line 99? Quote Do, or do not. There is no try. Order Editor 5.0.6 "Ultra Violet" is now available! For support or to post comments, suggestions, etc, please visit the Order Editor support thread. Link to comment Share on other sites More sharing options...
akent64 Posted June 6, 2007 Author Share Posted June 6, 2007 What code is found in and around /var/www/html/oscommerce/includes/functions/database.php on line 99? return mysql_fetch_array($db_query, MYSQL_ASSOC); Quote Link to comment Share on other sites More sharing options...
djmonkey1 Posted June 7, 2007 Share Posted June 7, 2007 return mysql_fetch_array($db_query, MYSQL_ASSOC); Well, the problem isn't in database.php. What file is it that you trying to view when you get the error? Quote Do, or do not. There is no try. Order Editor 5.0.6 "Ultra Violet" is now available! For support or to post comments, suggestions, etc, please visit the Order Editor support thread. Link to comment Share on other sites More sharing options...
akent64 Posted June 12, 2007 Author Share Posted June 12, 2007 Well, the problem isn't in database.php. What file is it that you trying to view when you get the error? I'm just trying to view a product on my database, when I click on the product, altohugh the picture is there for the product, once I click on it is says that no product has been found Quote Link to comment Share on other sites More sharing options...
djmonkey1 Posted June 20, 2007 Share Posted June 20, 2007 I'm just trying to view a product on my database, when I click on the product, altohugh the picture is there for the product, once I click on it is says that no product has been found What's in the address bar of your web browser when you see the error? Quote Do, or do not. There is no try. Order Editor 5.0.6 "Ultra Violet" is now available! For support or to post comments, suggestions, etc, please visit the Order Editor support thread. Link to comment Share on other sites More sharing options...
vova7777 Posted June 21, 2007 Share Posted June 21, 2007 Hi I am getting exactly the same error. However it shows only at catalog dir, checkout, login etc... When i view products, descriptions etc. the error disappeares . hmm what could be the problem? :huh: Quote Link to comment Share on other sites More sharing options...
djmonkey1 Posted June 21, 2007 Share Posted June 21, 2007 Hi I am getting exactly the same error.However it shows only at catalog dir, checkout, login etc... When i view products, descriptions etc. the error disappeares . hmm what could be the problem? :huh: Are you using the sort order contribution for product attributes? Quote Do, or do not. There is no try. Order Editor 5.0.6 "Ultra Violet" is now available! For support or to post comments, suggestions, etc, please visit the Order Editor support thread. Link to comment Share on other sites More sharing options...
splitbux Posted July 2, 2007 Share Posted July 2, 2007 (edited) I am having the same problem. Heres what happened i was using sort order contribution and i didnt like it so i removed the extra column it added in my mysql database and deleted the added in lines on the php files and i get that msg. How do i fix this. Edited July 2, 2007 by splitbux Quote Link to comment Share on other sites More sharing options...
ttime Posted August 13, 2007 Share Posted August 13, 2007 (edited) I have the same after installing QT Pro4.0.1.2 The address in the bar is product_info so something is wrong over there, but what to look for? Edited August 13, 2007 by ttime Quote Link to comment Share on other sites More sharing options...
m4verick Posted December 28, 2007 Share Posted December 28, 2007 (edited) I have the same, after installing Three images with admin 1.0 when I'm editing product. I use OSC 2.2 Edited December 28, 2007 by m4verick Quote Link to comment Share on other sites More sharing options...
Guest Posted December 29, 2007 Share Posted December 29, 2007 I receive the same fatal error when a customer adds a product to their shopping cart, clicks continue and enters the Checkout_shipping Page.....same line as well and also in my includes/functions/database.php Anyone have any ideas on this yet??? Quote Link to comment Share on other sites More sharing options...
Anono Posted July 15, 2008 Share Posted July 15, 2008 Here is help for the following error: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /var/www/html/oscommerce/includes/functions/database.php on line 99 Line 98-100 of my database.php file contained: function tep_db_fetch_array($db_query) { return mysql_fetch_array($db_query, MYSQL_ASSOC); } Clearly, somewhere in my code I had a call to tep_db_fetch_array, in which I was passing an invalid resource. The proper way to call tep_deb_fetch_array is to first prepare a select statement using tep_db_query, as shown below: $my_select_statement = 'Select * from ' . TABLE_CATEGORIES; $my_query = tep_db_query($my_select_statement); while ($my_result_row = tep_db_fetch_array($my_query)) { $my_cat_id = $my_result_row['categories_id']; .... } The function tep_db_query returns an resource of type 'mysql result'. If $my_query had been an invalid resource (eg not defined, or null, containing a string or numeric value, or containing anything at all other than a properly formed 'mysql result' resource), then it would have caused warning message I saw. One way of testing your code is to call mysql_query directly, bypassing all the osc wrappers, like so: $my_select_statement = 'Select * from ' . TABLE_CATEGORIES; $qr1 = mysql_query ($my_select_statement) or die ("Query failed: " . mysql_error() . " Actual query: " . $my_select_statement); In my case, I got this warning message after making a mistake in installing Linda McGrath's very nice addon Attributes Sorter and Copier (http://www.oscommerce.com/community/contributions,772) version 5.1b. It concerned some tricky merging of code in the file catalog\admin\categories.php, tricky because I had already edited that section of code with other addons (Additional Images and New Attribute Manager). I had the line: while ($new_images = tep_db_fetch_array($images_product)) { But $images_product was undefined because I had overwritten the code that defined it. The tricky section of code in file catalog\admin\categories.php started with: default: if ($rows > 0) { if (isset($cInfo) && is_object($cInfo)) { and ended with: } else { // create category/product info $heading[] = array('text' => '<b>' . EMPTY_CATEGORY . '</b>'); $contents[] = array('text' => TEXT_NO_CHILD_CATEGORIES_OR_PRODUCTS); } break; } By reinstalling this section of code from my backup, and then more carefully installing the Attributes Sorter and Copier addon, I was able to fix the problem. Stephan (VS) 1 Quote Link to comment 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.
Note: Your post will require moderator approval before it will be visible.