elargento23
1 month ago
207
1
Laravel

array_merge(): Expected parameter 1 to be an array, string given

Posted 1 month ago by elargento23

I have the following code:

public function selected_degree ($degree_id) {
    session(['degree_id' => $degree_id]);

    $question = DB::table('questions')
        ->select('questions.question_text','questions.answer_time_minutes','questions.answer_time_seconds', 'question_id')
        ->where('degree_id', session('degree_id'))
        ->orderByRaw('RAND()')
        ->take(1)->first();

    // save the question id returned in an array in session
    Session::push('questions', $question->question_id);
    // save the position as 0 because is the first time the query is run
    Session::put('array_position', 0);

    return view('2ndscreen', 'question');
}

I don't understand why I am getting this error: array_merge(): Expected parameter 1 to be an array, string given.

There are no more details about this error.

Please sign in or create an account to participate in this conversation.