Jump to content

help mysql order not working


chriscloyd

Recommended Posts

heres my problem i click the link and it doesnt change the order
heres my links

[CODE]
<html>
Order By <a href="?menu=company&page=news&order=id">Id</a>
<a href="?menu=company&page=news&order=title"> Title</a>
<a href="?menu=company&page=news&order=first,last"> Author</a>
</html>
[/CODE]

heres my script

[CODE]
<?php
if ($_POST['order']){
$order = $_POST['order'];
} else {
$order = 'id';
}
$query  = "SELECT * FROM news ORDER BY '$order' DESC LIMIT $limitvalue, $limit";       
$result = mysql_query($query) or die("Error: " . mysql_error());
?>
[/CODE]
Link to comment
https://forums.phpfreaks.com/topic/30691-help-mysql-order-not-working/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.