ORDER BY id DESC
Posted: Mon Oct 03, 2005 2:17 pm
well I need it to order, I got it to only get rows with the coloum console to equal xbox, but I would like it to descent not ascend, I tried this but it kept giving me back an error.
Code: Select all
<?php
$dbh=mysql_connect ("localhost", "user", "password") or die ('Cannot connect to the database because: ' . mysql_error());
mysql_select_db ("databasename");
$query = sprintf("SELECT * FROM content WHERE console='xbox' ORDER BY id DESC",
mysql_real_escape_string(xbox));
$result = mysql_query($query);
if (!$result) {
$message = 'Invalid query: ' . mysql_error() . "\n";
$message .= 'Whole query: ' . $query;
die($message);
}
while ($row = mysql_fetch_assoc($result))
{
echo 'bla bla bla';
}
mysql_free_result($result);
?>