PDA

View Full Version : supplied argument is not a valid MySQL result resource ...



Dragonmom
10-29-2003, 05:37 PM
this is a brand new install of msMAX v1.5
here is the total error I am getting
Warning: mysql_result(): supplied argument is not a valid MySQL result resource in /home/dragon/public_html/skelly/catalog/catalog_products_with_images.php on line 341

Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 71 in /home/dragon/public_html/skelly/catalog/catalog_products_with_images.php on line 344

Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 72 in /home/dragon/public_html/skelly/catalog/catalog_products_with_images.php on line 346
1064 - You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1

select distinct p.products_id, p.products_image, p.products_model, p.products_quantity, p.products_weight, pd.products_name, p.manufacturers_id, p.products_price, p.products_date_added, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price, m.manufacturers_name, pd.products_description, cd.categories_name from products_description pd, products p left join manufacturers m on p.manufacturers_id = m.manufacturers_id, products_to_categories p2c left join categories_description cd on p2c.categories_id = cd.categories_id left join specials s on p.products_id = s.products_id where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '1' and cd.language_id = '1' order by cd.categories_name, pd.products_name LIMIT 0,
[TEP STOP]
Here is the code that seems to be at fault;

$products_query_raw = "SELECT distinct p.products_id, p.products_image, p.products_model, p.products_quantity, p.products_weight, pd.products_name, p.manufacturers_id, p.products_price, p.products_date_added, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price, m.manufacturers_name, pd.products_description, cd.categories_name from " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_CATEGORIES_DESCRIPTION . " cd on p2c.categories_id = cd.categories_id left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . $languages_id . "' and cd.language_id = '" . $languages_id . "' order by $order";
$products_query = tep_db_query($products_query_raw);
//Discount used for Customer Discount Mod
if (PRODUCT_LIST_CUSTOMER_DISCOUNT) {
$discount = mysql_result(mysql_query("SELECT customer_discount from " . TABLE_CUSTOMERS . " where customers_id = '" . $customer_id . "'"), 0 , 0);
}
// Number of products to display per page
$limit = mysql_result(mysql_query("SELECT configuration_value from " . TABLE_CONFIGURATION . " WHERE configuration_key = 'PRODUCT_LIST_CATALOG_PERPAGE'"), 0 , 0);
What I THINK is the query_raw call is incorrect, I haven't seen that anywhere else. Am I right? Wrong?

michael_s
10-29-2003, 07:32 PM
I'm running the exact same version you are, and I do not get that error. What version of php,mysql are you using? Did you run the installer for ms2-max and import the database?

There is not a problem with ms2-max, so I am thinking it has to be something in your setup.

Dragonmom
10-30-2003, 06:53 AM
I'm running
PHP Version 4.3.1
Mysql Version 3.23.56
I'm pretty sure I imported the database, everything else seems to be working.
Is there a DB table I'm missing?
I looked at the php documentation and couldn't find anything that relates to that command, "_query_raw"