i want to have the data displayed from the DB sorted in a particular way. right now i call the data from the DB and it displays in the order of the table, and then use a javascript header gizmo to sort.
but i would rather the data show up sorted in the first place and use the js sort when i need to.
display in sorted order from DB
Moderator: General Moderators
Re: display in sorted order from DB
Code: Select all
$sql = 'SELECT `field1`, `field2` FROM `tblStuff` WHERE `category` = "'.mysql_real_escape_string($strFilter).'" ORDER BY `field3` ';Code: Select all
$sql = 'SELECT `field1`, `field2` FROM `tblStuff` WHERE `category` = "'.mysql_real_escape_string($strFilter).'" ORDER BY `field3` DESC ';Code: Select all
ORDER BY `field1` DESC, `field2` ASC