当我运行以下查询时发生以下错误:
Warning: mysql_fetch_assoc() expects parameter 1 to be resource
function get_subject_by_id( $subject_id ) {
global $connection;
$query = "SELECT * ";
$query .= "FROM subjects ";
$query .= "WHERE id=" . $subject_id ." ";
$query .= "LIMIT 1";
$result_set = mysqli_query( $connection, $query );
confirm_query( $result_set );
/* @var $subject type */
if ( $subject = mysql_fetch_assoc( $result_set ) ) {
return $subject;
} else {
return NULL;
}
}