session_start问题无法解决

时间:2018-05-28 22:55:59

标签: php html session phpmyadmin

<?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>

这是它给出的错误: 警告:session_start():无法发送会话缓存限制器 - 已在/ storage / ssd2 / 719/5658719 / public_html / cart中发送的标头(在/storage/ssd2/719/5658719/public_html/cart.php:1处开始输出)。第5行的PHP

我试图摆弄它,但我仍然无法解决它

0 个答案:

没有答案