Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

RE: [PHP-DB] Using a loop on a result destroys array??
-----Original Message-----
From: Mark Benson [mailto:markbenson@mac.com]=20

>The real problem you're having is the statement says "while there are=20
>results in this query, grab them" - once you reach the end of the first

>while loop, there are no more results, so the second one is skipped=20
>right over - it's condition *never* evaluates true.

So by running a "while (mysql_fetch_array($result)" loop over a fetch
array you effectively empty it?

<snip>

Well, not really - although in the end, yes, it will be 'empty' -
mysql_fetch_array actually fetches a single row (the next one, if
available) returned from the mysql query into an associative array.
You're being handed the data from mysql, one row at a time as requested,
and sticking it into an array.  $result is actually the resource id that
you give mysql so it knows what query to give you the information back
from.

- Martin Norland, Database / Web Developer, International Outreach x3257
The opinion(s) contained within this email do not necessarily represent
those of St. Jude Children's Research Hospital.

Report this thread to moderator Post Follow-up to this message
Old Post
Martin Norland
11-24-04 08:56 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

PHP DB archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 06:41 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.