Jump to content

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result


Recommended Posts

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.

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.

  • 5 weeks later...

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.)

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.