简体   繁体   中英

Mysqli_query() error that doesn't make sense to me

I am getting the error:

Warning: mysqli_query(): Couldn't fetch mysqli in /Users/phillipjordan/Desktop/Amatak/mule/settings/index.php on line 97

and I am not sure why because my code:

<?php
$host = "localhost";
$user = "root";
$password = "_______";
$port = 8889;
$db = "****";
$conn = new mysqli($host, $user, $password, $db);
ini_set("display_errors", 1);

if ($conn->connect_error) {
    die("not working");
    die();
}
?>
*other code*
$settingsquery = mysqli_query($conn, "SELECT * FROM settings WHERE userid=".$_SESSION["id"]);
$setting = mysqli_fetch_assoc($settingsquery);

seems sound, could somebody help? It appears that the error comes from the mysqli_query() function specifically. I couldn't post more code because stackoverflow wouldn't let me.

Never mind, I made a stupid mistake where I put $conn->close(); before the functions, sorry to waste your time.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM