dailce Posted March 27, 2008 Posted March 27, 2008 Hi, My sql skills aren't that great. I have the following from random products. The code selects products that are available. $sql_query[0] = tep_db_query("select p.products_id, p.products_quantity, p.products_image, p.products_tax_class_id, s.status, s.specials_new_products_price, p.products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where products_status = '1' order by p.products_ordered asc limit " . MAX_DISPLAY_NEW_PRODUCTS); How can I change this code so that I can select products that are available AND products that have a quantity greater than 0 ?????
arietis Posted March 27, 2008 Posted March 27, 2008 How can I change this code so that I can select products that are available AND products that have a quantity greater than 0 ????? try $sql_query[0] = tep_db_query("select p.products_id, p.products_quantity, p.products_image, p.products_tax_class_id, s.status, s.specials_new_products_price, p.products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where products_status = '1' && products_quantity > 0 order by p.products_ordered asc limit " . MAX_DISPLAY_NEW_PRODUCTS); off the top of my head, i think this should work but i haven't tested it so...standard disclaimers apply. :)
dmnalven Posted March 27, 2008 Posted March 27, 2008 The keyword should be AND (upper or lower case) not && For ALL problems, please review this link first -> osCommerce Knowledge Base
arietis Posted March 27, 2008 Posted March 27, 2008 The keyword should be AND (upper or lower case) not && AND and && both work...they're interchangeable. :) i guess it's a matter of preference.
dailce Posted March 27, 2008 Author Posted March 27, 2008 && and "and" both work, thanks for the help.
dmnalven Posted March 28, 2008 Posted March 28, 2008 Ya learn something new everyday! For ALL problems, please review this link first -> osCommerce Knowledge Base
Recommended Posts
Archived
This topic is now archived and is closed to further replies.