天天看点

mysql_fetch_array关闭,愚蠢的问题... mysql_fetch_array()

mysql_fetch_array关闭,愚蠢的问题... mysql_fetch_array()

Hey there

I have a dumb question....

Let''s say i have a database full of 4000 people.... I select everything

from the database by:

$result = mysql_query("SELECT * FROM People");

My question is about the results that I get... if I use:

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

//do stuff here

}

after "//do stuff here" is done (and let''s say its a LOT of stuff), and the

next row of data is fetched, is the row of data coming from the database,

or is it coming from the php variable $result?

basically, since i''m doing a LOT of things to each row (ie: sending them

each an email), i was wondering if the following code was helpful/pointless

....

$x = 1;

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

$Email[$x] = $row[''Email''];

$Name[$x] = $row[''Name''];

$x++;

}

... and THEN do my things by iterating through an array

foreach ($Email as $key=>$value) {

}

Is this totally redundant? I guess it all comes down to whether or not

mysql_fetch_array is going back to the database....

Basically I''m attempting to avoid any chance of losing a mysql connection

because the "//do stuff here" is taking so long....

Thanks in advance!

解决方案result = mysql_query("SELECT * FROM People");

My question is about the results that I get... if I use:

while (

row = mysql_fetch_array(

result)) {

//do stuff here

}

after "//do stuff here" is done (and let''s say its a LOT of stuff), and the

next row of data is fetched, is the row of data coming from the database,

or is it coming from the php variable