|
|
|
ช่วยสอนวิธีการดึงข้อมูล จาก DATABASE มาเก็บใน Array แล้ว วนลูปหน่อยครับ |
|
|
|
|
|
|
|
Code (PHP)
<?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 DESC LIMIT 50,5";
if ($result = $mysqli->query($query)) {
/* fetch associative array */
while ($row = $result->fetch_assoc()) {
printf ("%s (%s)\n", $row["Name"], $row["CountryCode"]);
}
/* free result set */
$result->close();
}
/* close connection */
$mysqli->close();
?>
|
|
|
|
|
Date :
2014-08-15 15:36:57 |
By :
Chaidhanan |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 03
|