Jump to content

SQL quiery


alienmojo

Recommended Posts

this is my first time to use the order by thing in php when i run the script it sayed that it failed

 

here is the quiery im passing in

 

SELECT * FROM estate WHERE price BETWEEN 0 AND 99999999999999 AND baths BETWEEN 0 AND 99999999999999 AND bedrooms BETWEEN 0 AND 99999999999999 AND ORDER BY price

Link to comment
https://forums.phpfreaks.com/topic/37566-sql-quiery/
Share on other sites

Ok, it look like you stored your price as string (Not recommended).

 

However, here is a work around:

 

...ORDER BY cast(price as unsigned)

 

Althought that can fix problem, it can cause other problem if you don't change the price to an appropriate data type.

Link to comment
https://forums.phpfreaks.com/topic/37566-sql-quiery/#findComment-179662
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.