Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is this correct?

Status
Not open for further replies.

keepingbusy

Programmer
Apr 9, 2000
1,470
GB

Hi

The following sql statement has been taken from a file called new_products.php which is part of an oscommerce website.

My issue is that I'm trying to set the order to products_id

I have already changed the code but I still get the same result and the product_id is not showing in that order.
Code:
select 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 where products_status = '1' [b]order by 
  p.products_id[/b] desc limit
I would appreciate some guidance.

Thank you
 

Simon

I think there is an additional piece of code after the [limit], I'll look at it later on today and post back.

Lee
 

The additional code on the end was:
Code:
 " . MAX_DISPLAY_NEW_PRODUCTS);
I'm sure this relates to the setting in the oscommerce admin panel.

I would be grateful for any assistance.
 

Found the problem. There was an else statement so I changed the part of the code to:
Code:
order by p.products_id limit
Now works perfectly!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top