0
<?php

    try{
    session_start();
    include("#nav.php");
    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);
    foreach($result as &$dat){
        $query = $db->prepare("SELECT * FROM shop WHERE id_img = :id_img");
        $query->bindParam("id_img", $dat['id_img']);
        $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: &dollar; " . 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");

        ?>
        <body>
            <?php
            ?>
        </body>
    </header>
</html>

this is the error it gives: Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /storage/ssd2/719/5658719/public_html/cart.php:1) in /storage/ssd2/719/5658719/public_html/cart.php on line 5

I've tried fiddling around with it but I still haven't been able to fix it

Arjen
  • 87
  • 7

0 Answers0