51工具盒子

依楼听风雨
笑看云卷云舒,淡观潮起潮落

简单实现PHP读取数据库

<?php
$server = "localhost";
$username = "root";
$password = "123456";
$dbname = "db";
$mysqli = new mysqli ($server, $username, $password, $dbname);
`$result = mysqli_query ($mysqli, "select * from account");
echo "<table border = '1px'>";
echo "<caption><b>账号列表</b></caption>";
echo "<tr><th>用户名</th><th>密码</th><th>邮箱</th></tr>";
while ($r = mysqli_fetch_object ($result)){
echo "<tr><td>" . $r->username . "</td><td>" . $r->password . "</td><td>" . $r->email ."</td></tr>";
}
echo "</table>";
mysqli_fetch_object ($result);
mysqli_close ($mysqli);
?>
`

mysqli_fetch_object

赞(1)
未经允许不得转载:工具盒子 » 简单实现PHP读取数据库