when i run the code it shows this error . "mysqli_query() expects parameter 1 to be mysqli, null given"
<?php
function confirm_query($result_set) {
if (!$reslt_set) {
die("database query failed");
}
}
function find_all_subjects() {
global $connection;
$query = "SELECT * ";
$query .= "FROM subjects ";
$query .= "WHERE visible=1 ";
$query .= "ORDER BY position ASC ";
$subject_set = mysqli_query($connection, $query);
confirm_query($subject_set);
return $subject_set;
}
?>
If that's your complete file then $connection
is going to be empty (null), you're not creating the connection anywhere.
You may be creating the connection in another file, hence global $connection;
but then you'd need to include this file to get the connection.
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加