I have a variable:
$orderby = orders.name;
$result = mysql_query("SELECT * FROM orders,categories WHERE orders.catid = categories.id AND orders.complete = '$complete' ORDER BY $orderby DESC");
Since I can't have the dot in $orderby. How can I pass it to the query, so that it orders by orders.name etc?
I am planning to use it in a query string, so should I use: admin.php?orderby=orders_name instead of orders.name? And how can I get the query formated correctly and use orders.name?



Reply With Quote



Bookmarks