How call stored procedure in wordpress?

admin

Administrator
Staff member
I want to call a MySql store procedure which have made in wordpress database before. But It always returns an empty array. Is something wrong with my code? Running this code in MySql prompt show rows correctly.

Code:
public static function get_job_list($job_title = '', $qualify = '',$id = ''){
        global $wpdb, $table_prefix;
        $query = "SET @id='{$id}'; SET @job_title='{$job_title}'; SET @qualify='{$qualify}'; 
                        CALL `sp_job_list`(@id, @job_title, @qualify);";
        $result = $wpdb->get_results($query);
        return $result;
    }