To achieve my goal, i am trying to follow an example in the comments to the mysql manual which says as follows "you can use ORDER BY on a UNION that consists of only one SELECT (and thus doesn't actually include the word "UNION"). Suppose you want the last 5 entries in a table, but you want them in ascending order. You can use this query:
( SELECT * FROM table_name ORDER BY ranking DESC
LIMIT 5 ) ORDER BY ranking;
I am trying to use the above as an example. With the code as i have modified, I get the following error in /var/log/httpd/mysite.com
line 251 starts as follows "$result = $oxyshout->query "PHP Parse error: parse error, unexpected T_STRING in /var/www/html/vh07/oxyshout/oxyshout_view.php on line 251, referer: http://www.dexter1976.com/
the original code was like this:
Code: Select all
$result = $oxyshout->query("SELECT user, contact, message, date, time, ip, session FROM ".$oxyshout->oxycfg['table_messages']." ORDER BY id DESC LIMIT ".$oxycfg["post_limit"]."");
$i = 0;
while($r = @mysql_fetch_array($result)) {i have modified code:
Code: Select all
$result = $oxyshout->query("SELECT user, contact, message, date, time, ip, session FROM ".$oxyshout->oxycfg['table_messages']." ORDER BY id DESC LIMIT ".$oxycfg["post_limit"]."") ORDER BY id;
$i = 0;
while($r = @mysql_fetch_array($result)) {