用于打印表中数据的PHP代码不起作用

时间:2016-05-09 17:33:02

标签: php mysql database

这是我的代码:

<!DOCTYPE html>
<html>
<body>
<?php
$servername = "localhost";
$username = "alasgsco_user";
$password = "pass123";
$dbname = "alasgsco_alasdb";
$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
} 
$sql = "SELECT 'ime' FROM 'kafici'";
$result = mysql_query($query);

while($row = mysql_fetch_array($result)){
echo "<p>" . $row['ime'] . "<br />";
}
$conn->close();
?>  
</body>
</html>

'kafici'是表的名称 'ime'是列的名称 为什么我的代码不起作用? 有人请帮帮我!提前谢谢。

0 个答案:

没有答案