coubury Posted July 6, 2009 Share Posted July 6, 2009 Hello. Im getting this error on a product page on my website 'Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/supremew/public_html/catalog/osc/products_new.php on line 89' ?> <tr> <td width="<?php echo SMALL_IMAGE_WIDTH + 10; ?>" valign="top" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products_new['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $products_new['products_image'], $products_new['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>'; ?></td> <td valign="top" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products_new['products_id']) . '"><b><u>' . $products_new['products_name'] . '</u></b></a><br>' . TEXT_DATE_ADDED . ' ' . tep_date_long($products_new['products_date_added']) . '<br>' . TEXT_MANUFACTURER . ' ' . $products_new['manufacturers_name'] . '<br><br>' . TEXT_PRICE . ' ' . $products_price; ?></td> <!--Start JLG Disable Buy Now and Shopping Cart--> <?php ?> <tr> <td width="<?php echo SMALL_IMAGE_WIDTH + 10; ?>" valign="top" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products_new['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $products_new['products_image'], $products_new['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>'; ?></td> <td valign="top" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products_new['products_id']) . '"><b><u>' . $products_new['products_name'] . '</u></b></a><br>' . TEXT_DATE_ADDED . ' ' . tep_date_long($products_new['products_date_added']) . '<br>' . TEXT_MANUFACTURER . ' ' . $products_new['manufacturers_name'] . '<br><br>' . TEXT_PRICE . ' ' . $products_price; ?></td> <!--Start JLG Disable Buy Now and Shopping Cart--> <?php $nononline_items = array(); $sql = "SELECT products_id FROM products WHERE disable_addtobasket='Y'"; $result = mysql_query($sql); while($id = mysql_fetch_array($result,MYSQL_ASSOC)){ array_push($nononline_items,$id['products_id']); } if (in_array($products_new['products_id'],$nononline_items)){ echo ("<td align=\"right\">". NON_ONLINE_ITEM ."</td>"); } else{ echo "<td align=\"right\" valign=\"middle\" class=\"main\">"; echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_NEW, tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $products_new['products_id']) . '">' . tep_image_button('button_in_cart.gif', IMAGE_BUTTON_IN_CART) . '</a>'; echo "</td>"; } ?> <!--End JLG Disable Buy Now and Shopping Cart--> $sql = "SELECT products_id FROM products WHERE disable_addtobasket='Y'"; $result = mysql_query($sql); while($id = mysql_fetch_array($result,MYSQL_ASSOC)){ array_push($nononline_items,$id['products_id']); } if (in_array($products_new['products_id'],$nononline_items)){ echo ("<td align=\"right\">". NON_ONLINE_ITEM ."</td>"); } else{ echo "<td align=\"right\" valign=\"middle\" class=\"main\">"; echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_NEW, tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $products_new['products_id']) . '">' . tep_image_button('button_in_cart.gif', IMAGE_BUTTON_IN_CART) . '</a>'; echo "</td>"; } ?> <!--End JLG Disable Buy Now and Shopping Cart--> In red is line89 Can anyone help? I really have no idea what to edit Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/164915-warning-mysql_fetch_array-supplied-argument-is-not-a-valid-mysql-result/ Share on other sites More sharing options...
Maq Posted July 6, 2009 Share Posted July 6, 2009 That error usually signifies that your SQL statement is not valid. Temporarily add an or die() clause to see what the error is. $result = mysql_query($sql) or die(mysql_error()); Please don't post your entire code. You need to also use tags, not quotes. Quote Link to comment https://forums.phpfreaks.com/topic/164915-warning-mysql_fetch_array-supplied-argument-is-not-a-valid-mysql-result/#findComment-869739 Share on other sites More sharing options...
SilentRebounder18 Posted August 5, 2009 Share Posted August 5, 2009 I anticipate that it was absurdity that usually signifies that your SQL account is not valid. _________________ Furnace filters Quote Link to comment https://forums.phpfreaks.com/topic/164915-warning-mysql_fetch_array-supplied-argument-is-not-a-valid-mysql-result/#findComment-891341 Share on other sites More sharing options...
Maq Posted August 5, 2009 Share Posted August 5, 2009 I anticipate that it was absurdity that usually signifies that your SQL account is not valid. _________________ Furnace filters Care to elaborate? (P.S. - You don't have to create your own signature, there's one built in.) Quote Link to comment https://forums.phpfreaks.com/topic/164915-warning-mysql_fetch_array-supplied-argument-is-not-a-valid-mysql-result/#findComment-891347 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.