<?php
$servername = "localhost";
$username = "root";
$password = "william";
$dbname = "camping";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "SELECT fnavn,enavn,epost,tlf FROM knr ";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
echo "id: " . $row["fnavn"]. " - Name: " . $row["enavn"]. " " . $row["epost"]. "ire: " . $row["tlf"]."<br>";
}
} else {
echo "0 results";
}
$conn->close();
?>
試過了,它不工作,誰知道爲什麼?這是什麼毛病第二if語句我覺得PHP從數據庫中選擇數據
歡迎SO。 請閱讀[我可以問哪些主題](http://stackoverflow.com/help/on-topic) 和[如何提出一個好問題](http://stackoverflow.com/help/how-to - 問) 和[完美的問題](http://codeblog.jonskeet.uk/2010/08/29/writing-the-perfect-question/) – RiggsFolly
嘗試從一個SQL教程http://www.tutorialspoint開始.com/sql/ – RiggsFolly
'SELECT(???)FROM produkt' - 你意識到你在這裏沒有選擇任何東西。 –