I have an sql query that is already written, but the from command is lowercase. I like the formatting of it being uppercase but if I change it I get error 1064.
select, where, and etc were all lowercase as well but when I change to upper they work fine, it is only the WHERE statement that causes this.
Here is the sql:
$listing_sql = "SELECT " . $select_column_list .
"p.products_id, p.products_model, p.manufacturers_id, 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 ".
"FROM " .
TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS . " p left join " .
TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id left join " .
TABLE_SPECIALS . " s on p.products_id = s.products_id, " .
TABLE_PRODUCTS_TO_CATEGORIES . " p2c WHERE p.products_status = '1' AND " .
"p.products_id = p2c.products_id and pd.products_id = p2c.products_id and " .
"pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" .
(int)$current_category_id . "'";
Here is what the sql looks like when echo'd:
SELECT p.products_image,
pd.products_name,
p.products_id,
p.products_model,
p.manufacturers_id,
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
FROM products_description pd,
products p
LEFT JOIN manufacturers m
ON p.manufacturers_id = m.manufacturers_id
LEFT JOIN specials s
ON p.products_id = s.products_id,
products_to_categories p2c
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 p2c.categories_id = '36'