How do I sort mysql table result in ORDER BY 2 columns
Posted: Thu May 21, 2015 7:49 am
Hello Friends,
I have a products table with several columns. On my Home page I want to display 30 items at random but all new Items to come first. Below are the codes I tried.
How do I make them into one line.
Thanks
I have a products table with several columns. On my Home page I want to display 30 items at random but all new Items to come first. Below are the codes I tried.
Code: Select all
$sql = mysql_query("SELECT * FROM products WHERE status='Online' && nature='Yes' ORDER BY RAND() LIMIT 5"); //FOR ONLY NEW ITEMS
$sql = mysql_query("SELECT * FROM products WHERE status='Online' && nature!='Yes' ORDER BY RAND() LIMIT 35"); //FOR OTHER ITEMS
Thanks