<?php
try{
    session_start();
    if(!isset($_SESSION['on'])) {
    header("location:homepage.php"); 
    }
    include('dbconnectie.php');
    $query = $db->prepare("SELECT id_img FROM cart WHERE id_u = :id");
    $query->bindParam("id", $_SESSION['id_u']);
    $query->execute();
    $result = $query->fetchALL(PDO::FETCH_ASSOC);
    $query = $db->prepare("SELECT * FROM shop WHERE id_img = :id_img");
    $query->bindParam("id_img", $result);
    $query->execute();
    $result1 = $query->fetchALL(PDO::FETCH_ASSOC);
    echo "<table>";
            foreach($result1 as &$data) {
                echo "<tr>";
                    $img = $data['img_url'];
                    echo "<td>" . $data["brand"] . "</td>";
                    echo "<td>" . $data["model"] . "</td>";
                    echo "<td> Condition: " . $data["cond"] . "/10 </td>";
                    echo "<td> Prijs: $ " . number_format($data["price"],2,",",".") . "</td>";
                    echo "<td> <img src='$img' width='400' height='300' ></img> </td>";
                    echo "<td>" . $data['id_img'] . "</td>";
                echo "</tr>";
            }
    echo "</table>";
    } catch(PDOException $e) {
        die("Error!: " . $e->getMessage());
    }
?>
<html>
    <title>Just for kicks</title>
    <header>
         <?php
            include("#nav.php");
        ?>
    </header>
</html>
on line 13 it says: Notice: Array to string conversion in /storage/ssd2/719/5658719/public_html/cart.php on line 13 ?>
I am unsure how to fix this. What I'm trying to do is get all the id_img's from table cart that correspond with $_SESSION['id_u'] which in the table is id_u. Then what I'm trying to do is for every id_img i'm trying to get all of the details from table shop which corresponds to id_img. like brand, model and cond.
Someone in the comments referred me to a possible answer but even with that I'm unable to understand how to fix the problem I'm having.
 
    