question - display rows
| From: | Phil Schwarzmann | Date: | Sat, 23 Mar 2002 02:12:28 +0000 |
| Subject: | question - display rows | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-89802@lists.php.net to get a copy of this message | ||
When I want to display a table onto the screen I use this code....
$query = "SELECT * FROM database";
$result = mysql_query($query);
$num_rows = mysql_num_rows($result);
for ($i = 0; $i < $num_rows; $i++) {
$field1 = mysql_result($result, $i, field1);
$field2 = mysql_result($result, $i, field2);
echo $field1.$field2;
}
...but I heard that using mysql_result() is very ineffecient and that I
should be using mysql_fetch_array() instead.
So how could produce those same results using mysql_fetch_array()
instead??
THANKS!! YOU GUYS ROCK!!!