Re: How to inverse the date sorting
| From: | Wizaerd) | Date: | Thu, 15 Feb 2001 17:18:34 +0000 |
| Subject: | Re: How to inverse the date sorting | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-39949@lists.php.net to get a copy of this message | ||
add a DESC to your order by clause... fairly simple SQL syntax, could be picked up from a myriad of SQL references and manuals
$sql = "select * from table_name WHERE TO_DAYS(NOW()) - TO_DAYS(date) <= 21 order by date DESC";
At 12:14 PM 2/15/01 -0500, Malouin Design Graphique wrote:
Hello,
Anybody here would know, how I could inverse the date sorting or ordering?
This script below gives me for example:
2001-01-01
2001-01-15
2001-01-31
and so on...
when I wish it would gives me:
2001-01-31
2001-01-15
2001-01-01
and so on...
---------------------------------------------
<?php
$db = mysql_connect("servername.com", "root", "password");
mysql_select_db("stats", $db);
$sql = "select * from table_name WHERE TO_DAYS(NOW()) - TO_DAYS(date) <= 21 order by 'date'";
$result = mysql_query( $sql );
while ( $row = mysql_fetch_array( $result ) )
{
echo "<tr><td><span class=\"size1\"><b>$row[date]</b><br><img src=\"$row[indice_url]\"><br>$row[indice]<hr noshade size=\"1\"></span></td></tr>\n";
}
?>
---------------------------------------------
Thanks again for your help.
Merci beaucoup,
Yves
--
------------------------
Malouin Design Graphique
http://www.malouin.qc.ca
Québec (Québec) CANADA
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net