You are here: Re: ORDER BY order of months « All PHP « IT news, forums, messages
Re: ORDER BY order of months

Posted by kenoli on 11/15/05 15:51

I solved the problem. I was using "date" which is also the name of the
field as the alias. When I used a different name for the alias ("d")
it started ordering corredtly. It was getting the formatting right and
most of the ordering but not completely. When I changed the alias name
it started working correctly. I wonder what it was doing?

The corrected query reads:

$query = "SELECT date_format(date, '%c.%e.%Y') as d, summary
FROM tbl_news_stories ORDER BY date DESC";
$result = mysql_query ($query);

while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {

echo "<p>{$row['d']} - {$row['summary']}</p>";

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация