itfitz_design Posted July 27, 2010 Posted July 27, 2010 Hello, I am reciving the "1064 - You have an error in your SQL syntax......." error that a lot of people seem to be getting. I found Simplyeasier's post in the Tips and Tricks section and attempted every fix listed and none of them took care of the issue. The most frustrating part is that when you search for something irrelevant like "puppies" it displays "There is no product that matches the search criteria." as it should. As soon as you search for something in the product listing like "Team Associated" it brings up the 1064 error. Any help would be MUCH appreciated. here is the full error: 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 'from products p left join manufacturers m using(manufacturers_id) left join spec' at line 1 from products p left join manufacturers m using(manufacturers_id) left join specials s on p.products_id = s.products_id, products_description pd, categories c, products_to_categories p2c where p.products_id = pd.products_id and pd.language_id = '1' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and ((pd.products_name like '%rear%' or p.products_model like '%rear%' or m.manufacturers_name like '%rear%') ) order by pd.products_name limit 0, 20 [TEP STOP]
MrPhil Posted July 31, 2010 Posted July 31, 2010 The SQL query is missing its front half. It should start out select field_name, field_name, field_name from..., but all the stuff before "from" is missing. Something has corrupted the code in the file advanced_search_result.php. You should see the following in that file: $select_str = "select distinct " . $select_column_list . " m.manufacturers_id, p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, 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 "; if ( (DISPLAY_PRICE_WITH_TAX == 'true') && (tep_not_null($pfrom) || tep_not_null($pto)) ) { $select_str .= ", SUM(tr.tax_rate) as tax_rate "; } $from_str = "from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m using(manufacturers_id) left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id"; and later, after more stuff has been added to the $from_str: $listing_sql = $select_str . $from_str . $where_str . $order_str; For whatever reason, $select_str is empty or missing, and the SQL query ($listing_sql) starts with the "from" clause.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.