note 95881 added to mysqli-result.fetch-array
| From: | Jammerx2 at osu1 dot php dot net | Date: | Wed, 27 Jan 2010 03:09:36 +0000 |
| Subject: | note 95881 added to mysqli-result.fetch-array | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-165351@lists.php.net to get a copy of this message | ||
Putting multiple rows into an array:
<?php
$mysqli = new mysqli("localhost", "my_user", "my_password",
"world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$query = "SELECT Name, CountryCode FROM City ORDER by ID LIMIT 3";
$result = $mysqli->query($query);
while($row = $result->fetch_array())
{
$rows[] = $row;
}
foreach($rows as $row)
{
echo $row['CountryCode'];
}
/* free result set */
$result->close();
/* close connection */
$mysqli->close();
?>
----
Server IP: 69.147.83.197
Probable Submitter: 99.239.152.153
----
Manual Page -- http://www.php.net/manual/en/mysqli-result.fetch-array.php
Edit -- https://master.php.net/note/edit/95881
Del: integrated -- https://master.php.net/note/delete/95881/integrated
Del: useless -- https://master.php.net/note/delete/95881/useless
Del: bad code -- https://master.php.net/note/delete/95881/bad+code
Del: spam -- https://master.php.net/note/delete/95881/spam
Del: non-english -- https://master.php.net/note/delete/95881/non-english
Del: in docs -- https://master.php.net/note/delete/95881/in+docs
Del: other reasons-- https://master.php.net/note/delete/95881
Reject -- https://master.php.net/note/reject/95881
Search -- https://master.php.net/manage/user-notes.php