嘿,这是我的代码我不能执行回声" ok"不显示。我该怎么办呢。
<?php
$username = "root";
$password = "";
$db = "db2";
// Create connection
$conn = mysqli_connect("localhost", $username, $password, $db);
if (!@$conn) {
die ("Unable to Connect!");
}
else {
echo "Connected!";
}
$sql = "SELECT 'food', 'calorie' FROM 'food' ORDER BY 'id'";
$query = mysqli_query($conn, $sql);
if ($query) {
echo "ok";
}
?>
答案 0 :(得分:-2)
<?php
$username = "root";
$password = "";
$db = "db2";
// Create connection
$conn = mysqli_connect("localhost", $username, $password, $db);
if (!@$conn) {
die ("Unable to Connect!");
}
else {
echo "Connected!";
}
$sql = "SELECT food, calorie FROM food ORDER BY id";
$query = mysqli_query($conn, $sql);
if ($query) {
echo "ok";
}
?>