You are here: Re: Problem with while « PHP Programming Language « IT news, forums, messages
Re: Problem with while

Posted by Jerry Stuckle on 01/25/07 05:27

zek2005 wrote:
> I am doing the following statement to retrieve results:
>
> $response = mysql_query("select * from preguntas where tema=$tema",
> $db);
> $row = mysql_fetch_array($response);

This fetches the first row

> while($row = mysql_fetch_array($response))

This fetches the second (and subsequent) rows, throwing away the results
of the first (and previous) rows.

> {
> echo('<font face="Tahoma" size="2">');
> echo('<p align="left">');
> echo($f .'- <a href="respuestas.php?id='. $row[id]. '">'
> .$row[pregunta]. '</a>');
> $f++;
> }
>
> I receive 2 items as a result. But if I check inside the DB, the result
> should be 3 items....I am loosing the first record.
>
> Any ideas about what could be wrong?
>
> Regards,
>
> Ezequiel
>

Get rid of the first

$row = mysql_fetch_array($response);


--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

 

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

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