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 Chris Miller 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 issuse 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 and if this question is in the wrong forum, please let me know.

Thank you
 
this is the wrong forum. mysql would be better.

but as an off the cuff observation, is it possible that product_id is not set as an integer data type? if not you may be getting an order like 1, 11, 12, 13, 14 etc (or the inverse).
 

Hi jpadie

I'll post this in hte forum mentioned and yes, the product_id is set as integar.

Thnak you
 
When I run a similar style query in MySQL Query Browser, the superfluous "limit" at the end of your query screws it up and it returns no results. Is this simply a typo? Or have you unknowingly missed off a numeral after the "limit" keyword?

Clive
Runner_1Revised.gif

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"To err is human, but to really foul things up you need a computer." (Paul Ehrlich)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To get the best answers from this forum see: faq102-5096
 
agreed. my assumption was this was a typo or a php variable followed it and was not quoted as the OP is complaining of badly ordered results rather than no results.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top