Ordering a query
| From: | nate at 1feehosting dot com | Date: | Sat, 08 Sep 2001 02:04:37 +0000 |
| Subject: | Ordering a query | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-66507@lists.php.net to get a copy of this message | ||
I use the following code to order the results of the query by the variable $order.
$result = mysql_query("SELECT
articles.title,vote.votes,vote.total,articles.date,staff.firstname,articles.content,articles.id FROM
staff,articles,vote WHERE articles.authorid = staff.id AND articles.id = vote.item ORDER BY
$order DESC",$db);
I assign the variable a value according to my url, http://www.mysite.com/file.php?order=something
My question is. Is there a way of assigning the $order variable a default value? Like if they hit http://www.mysite.com/file.php without the order=something
can I tell the script to assign $order a default value?
Thanks,
Nate