看起来你没有连接到任何东西。您还需要用逗号分隔列名:
SELECT id, menu_id, menu_title FROM tbl_menu
这是文档中的一个mysqli_
示例:
<?php
$link = mysqli_connect("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$query = "SELECT id, menu_id, menu_title FROM tbl_menu";
if ($result = mysqli_query($link, $query)) {
/* fetch associative array */
while ($row = mysqli_fetch_assoc($result)) {
echo $row[menu_id];
}
/* free result set */
mysqli_free_result($result);
}
/* close connection */
mysqli_close($link);
?>