You are here: Re: database, *_fetch_array(),while() issue. « PHP Programming Language « IT news, forums, messages
Re: database, *_fetch_array(),while() issue.

Posted by Andy Jeffries on 05/09/06 23:27

On Tue, 09 May 2006 13:16:28 -0700, gmac63 wrote:
> ... it doesn't want to print the second while() loop unless I do the query
> again:

The reason is that sqlite_fetch_array (as with all *_fetch_array
functions) has to maintain an internal record pointer so it know what the
next record to retrieve is. If it started from the beginning after
hitting the end of the result set, your first while loop would never end.

So after retrieving the last result in the first while loop, the record
pointer is set to say "no more records", so the first iteration of your
second while loop will find "no more records".

What I believe you want to do is issue an sqlite_rewind($result).

However, I've never used sqlite before, but that would definitely be
correct for MySQL.

Cheers,


Andy

--
Andy Jeffries MBCS CITP ZCE | gPHPEdit Lead Developer
http://www.gphpedit.org | PHP editor for Gnome 2
http://www.andyjeffries.co.uk | Personal site and photos

 

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

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