你好,我想从表中显示我的客户信息,但我不能在php中使用我的新功能。这是我的代码
reviews
你能帮帮我吗?我该如何解决这个问题......
答案 0 :(得分:1)
更新的代码:
<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "company";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "SELECT * FROM musteri";
$result = $conn->query($sql);
?>
<html>
<head>
<title>Customer Data</title>
</head>
<body>
<table width="600" border="1" cellpadding="1" cellspacing="1">
<tr>
<th>ID</th>
<th>Age</th>
<th>Email</th>
<th>Doğum Tarihi</th>
</tr>
<?php
if ($result->num_rows > 0) {
// output data of each row
while($customer = $result->fetch_assoc()) {
echo "<tr>";
echo "<td>".$customer['id']."</td>";
echo "<td>".$customer['age']."</td>";
echo "<td>".$customer['email']."</td>";
echo "<td>".$customer['dogumtarih']."</td>";
echo "</tr>";
}
}
?>
</table>
</body>
</html>