gpt4 book ai didi

php - sql查询有问题

转载 作者:行者123 更新时间:2023-11-29 01:16:14 25 4
gpt4 key购买 nike

<分区>

请检查这段代码,如果有任何错误请告诉我。

// Create connection
$conn = mysqli_connect($servername, $username, $password, $shop_item);
// Check connection
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
$item_sql = "SELECT * FROM shop-items";
mysqli_query($conn, 'SET CHARACTER SET utf8;');
$result_item = mysqli_query($conn, $item_sql);

echo var_dump($result_item); //returns: bool(false)
if (mysqli_num_rows($result_item) > 0) { // doesn't execute. the error is "mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean";

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com