stevennickelby Posted August 7, 2006 Share Posted August 7, 2006 (edited) sorry about the mispelling of slight. hello everyone, for this part of query script $new_products_query = tep_db_query("select distinct p.products_id, p.products_image, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c where p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id = '" . $new_products_category_id . "' and p.products_status = '1' order by p.products_date_available desc limit " . MAX_DISPLAY_NEW_PRODUCTS); I've been trying to add this in... pd where to_days(products_date_available) >= to_days(now()) but I keep getting syntax errors... how can it fit in to the top script? (idealy i want p.products_date_available desc limit to be p.products_date_available asc limit and have pd where to_days(products_date_available) >= to_days(now()) in there so it takes the earliest dates only from today's date onwards similar to the script below.... can someone help me?thanks for yor time! $upcoming_products_query = tep_db_query(" select p.products_id, pd.products_name, products_date_available as date_expected from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where to_days(products_date_available) >= to_days(now()) and p.products_id = pd.products_id and pd.language_id = ' " . (int)$languages_id . " ' order by " . EXPECTED_PRODUCTS_FIELD . " asc limit " . MAX_DISPLAY_UPCOMING_PRODUCTS); Edited August 7, 2006 by stevennickelby Quote Link to comment Share on other sites More sharing options...
kgt Posted August 7, 2006 Share Posted August 7, 2006 At first glance it looks fine to me. You haven't posted any actual error messages, so it's hard to tell what's wrong. Quote Contributions Discount Coupon Codes Donations Link to comment Share on other sites More sharing options...
stevennickelby Posted August 7, 2006 Author Share Posted August 7, 2006 At first glance it looks fine to me. You haven't posted any actual error messages, so it's hard to tell what's wrong. The red script sorts the products by the furthest in the future first, Instead i would like the script to sort by the the least furthest in the future first (not the furthest). I think this script can do that, but i don't know where to place him? pd where to_days(products_date_available) >= to_days(now()) I tried placing just after TABLE_PRODUCTS_TO_CATEGORIES . " but i came up with an error, I'm not to sure how to put this into the script?? Quote Link to comment Share on other sites More sharing options...
kgt Posted August 7, 2006 Share Posted August 7, 2006 Table TABLE_PRODUCTS_TO_CATEGORIES is not in the example SQL statement you posted. Please post the exact statement you're trying to edit, including it's original form and with your changes included. Also post the error that you get after you make your change. Quote Contributions Discount Coupon Codes Donations Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.