您的当前位置:首页>全部文章>文章详情

php实现从数据库查询数据 (使用MySQLi)

发表于:2024-03-02 20:39:19浏览:91次TAG: #PHP

PHP从数据库查询数据 (使用MySQLi):

<?php  
$conn = mysqli_connect("localhost", "username", "password", "database");  
$result = mysqli_query($conn, "SELECT * FROM users");  

while ($row = mysqli_fetch_assoc($result)) {  
    echo "Name: " . $row['name'] . "<br>";  
}  

mysqli_close($conn);  
?>