-2

次のクエリを実行すると、次のエラーが発生します。

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;
    }
}
4

2 に答える 2