0

I want to save multiple images in an array but because an image is an array my approach didn't work.

This was my approach:

for($i=2;$i<=$image_row;$i++){
    $image = 'image'.$i;
    $allImages[] = array(   
        'image' => $mysqli->real_escape_string($_SESSION[$image]));
}

1 Answer 1

1

So why are you defining your image in an array?

Why not simply:

for($i=2;$i<=$image_row;$i++){
    $image = 'image'.$i;
    $allImages[] = $mysqli->real_escape_string($_SESSION[$image]);
}
Sign up to request clarification or add additional context in comments.

1 Comment

That still gives me the error "Warning: mysqli::real_escape_string() expects parameter 1 to be string, array given"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.