gpt4 book ai didi

php - 给出警告 : mysqli_query() expects parameter 1 to be mysqli, 资源

转载 作者:可可西里 更新时间:2023-11-01 06:34:23 27 4
gpt4 key购买 nike

<分区>

我的代码中出现了这个错误,我不知道如何解决我的代码:

<?php
session_start();
include_once"connect_to_mysql.php";

$db_host = "localhost";
// Place the username for the MySQL database here
$db_username = "root";
// Place the password for the MySQL database here
$db_pass = "****";
// Place the name for the MySQL database here
$db_name = "mrmagicadam";

// Run the actual connection here
$myConnection= mysql_connect("$db_host","$db_username","$db_pass") or die ("could not connect to mysql");
mysql_select_db("mrmagicadam") or die ("no database");
$sqlCommand="SELECT id, linklabel FROM pages ORDER BY pageorder ASC";
$query=mysqli_query($myConnection, $sqlCommand) or die(mysql_error());
$menuDisplay="";


while($row=mysql_fetch_array($query)) {
$pid=$row["id"];
$linklabel=$row["linklabel"];
$menuDisplay='<a href="index.php?pid=' .$pid . '">' .$linklabel. '</a><br/>';
}
mysqli_free_result($query);

?>

这是错误:

Warning: mysqli_query() expects parameter 1 to be mysqli, resource given in C:\xampp\htdocs\limitless\connect_to_mysql.php on line 17

我做错了什么?

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