Here is a moment when PHP does one thing on one day, but refuses on another.
I want to sort the data in a table from a MySQL query.
To do this I am passing the field name to a $_REQUEST via the URL, like so:
Code: Select all
<a href='{$_SERVER['PHP_SELF']}?page=adminlinks&order=category' style='text-decoration: none; color: #ffffff;'>Category</a>Code: Select all
order=categoryCode: Select all
$sort = $_REQUEST['order'];
if($sort == NULL) { $sort=urldisplay; }And this is the MySQL statement:
Code: Select all
$result = mysql_query ("SELECT * FROM lincslinks ORDER BY $sort");The error given here is basically say it cannot find anything in results.
The code doesn't cater for "no results found" as there will always be something in there.... so no point really.
If anyone can help or has seen this before and knows of a fool proof method, please tell me.
It's always the stupid things can get in our way, isn't it.