RE: [PHP] putting the results of a query inro an array
| From: | Jay Blanchard | Date: | Mon, 18 Apr 2005 13:55:49 +0000 |
| Subject: | RE: [PHP] putting the results of a query inro an array | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-213268@lists.php.net to get a copy of this message | ||
[snip]
The only fields are 'name' and 'email'
$query = "SELECT * FROM contacts";
$result= mysql_query($query);
$number= mysql_num_rows ($result);
[/snip]
Using * in a query like this is bad form....spell it out
while($row = mysql_fetch_array($result){
$arrayName[] = $row['name'];
$arrayEMail[] = $row['email'];
}
print_r($arrayName);
print_r($arrayEMail);