You are here: Re: [PHP] help with "ORDER BY" query « PHP « IT news, forums, messages
Re: [PHP] help with "ORDER BY" query

Posted by John Nichel on 07/29/05 18:34

Jesús Alain Rodríguez Santos wrote:
> I have a query:
>
> $query = mysql_query("SELECT event FROM table WHERE month = 'x' ORDER BY
> day ASC");
>
> I have all days of the month insert in day field: 1, 2, 3, 4, 5 ...
>
> when I print the query:
> if ($query_r = mysql_fetch_array($query)) {

-----------------^

Right there, you called the first result row, then below....

> do {
> echo "<td width='8%'>".$query_r['event']."</td>\n";
> } while ($query_r = mysql_fetch_array($query));

-------------------------^

You call it again, and since you already called for the first row, this
time it is returning results starting from the second row.

> echo "</tr> \n";
> } else {
> echo "No se encontraron registros";
> }
>
> It print all result of the query, less day 1
> What it's the problem
>
>
>


--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
john@kegworks.com

 

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

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