question about sorting
Posted: Fri May 26, 2006 1:51 pm
I have the following :
and i have links Sort by [ TIME POSTED ] [ PROJECT NAME ] [ PAGE VIEWS] [ OWNER ] [ MAX PRICE]
can i change "ORDER BY timeposted" with a variable? What i want is to allow users to choose how to sort their results.
thanks!
Code: Select all
mysql_select_db($database_pickageek, $pickageek);
$query_projects = sprintf("SELECT Projectname, Description, Phase, Pview, timeposted, ownerid, category, pricemin, pricemax, dateposted, ID FROM projects WHERE category = '%s' ORDER BY timeposted ASC", $colname_projects);
$query_limit_projects = sprintf("%s LIMIT %d, %d", $query_projects, $startRow_projects, $maxRows_projects);
$projects = mysql_query($query_limit_projects, $pickageek) or die(mysql_error());
$row_projects = mysql_fetch_assoc($projects);can i change "ORDER BY timeposted" with a variable? What i want is to allow users to choose how to sort their results.
thanks!