How does mysql_fetch_array() work?

From: Date: Sun, 17 Mar 2002 16:53:23 +0000
Subject: How does mysql_fetch_array() work?
Groups: php.db 
Request: Send a blank email to php-db+get-17722@lists.php.net to get a copy of this message
In the following example, does the while loop with mysql_fetch_array() query the server each time through the loop? Or does it do everything, while parsing, using $result? Or is there some other subtlety I'm missing? How is this working and where is the work being done? Thanks, Glenn. <?php mysql_connect($host, $user, $password); mysql_select_db("database"); $result = mysql_query("select user_id, fullname from table"); while ($row = mysql_fetch_array($result)) { echo "user_id: ".$row["user_id"]."<br>\n"; echo "user_id: ".$row[0]."<br>\n"; echo "fullname: ".$row["fullname"]."<br>\n"; echo "fullname: ".$row[1]."<br>\n"; } mysql_free_result($result); ?>

« previous php.db (#17722) next »