PHP 5中使用MySQLi扩展的例子。
代码:
<?php
/**
* mysqli扩展示例
* by www.jb200.com
*/
$mysqli = mysqli_connect("localhost", "root", "","mydatabase", 3306);
$result = mysqli_query($mysqli, "SELECT * FROM mytable");
while($row = mysqli_fetch_array($result)) {
foreach($row as $key => $value) {
echo "$key = $value</BR>n";
}
}
mysqli_free_result($result);
mysqli_close($mysqli);
?>