i have a small issue i have this code $sql = "SELECT * FROM $tbl_name ORDER BY id DESC LIMIT $start, $limit"; where my results are ordered by id, now what i want is to input a second order by "date" in the same querry. is it possible ?
When you want to sort or 'order by' multi columns, you just list the coloumn names in the order of their precedence (left > right), each separated by a comma. Your write again complete: $sql = "SELECT * FROM $tbl_name ORDER BY id DESC, date DESC LIMIT $start, $limit";
Thank you phppro9x i think this is the correct syntax, but my date is in this format 2011-04-05 and didn't sort by date too... should i change the date format ?