根据id php获取文章图片

时间:2016-06-13 21:14:21

标签: php image pdo

我正在尝试从数据库中获取所有文章和图片$。 问题是我无法弄清楚如何根据文章ID获取图像:

enter image description here

<?php include('navindex.php');?>
    <div class="container">
        <?php 
        include('pdo.php');
        /*
        $sql = "SELECT * FROM annonce WHERE id_annonce =:id";
        $query = $open->prepare($sql);
        */ 

        $sql = "SELECT * FROM annonce WHERE id_annonce=id_annonce";
        //$sql = "SELECT * FROM widgets WHERE something='something else'";
        /*
        foreach ($open->query($sql) as $results)
        {
            $id = $results["id_annonce"];
        }

        */


        //print_r($result);
        ?>
        <div class="row">
                <div class="col-md-4">
                    <div class="thumbnail">
                        <img src="image/thumbnail.png">
                        <div class="caption">
                            <h3>Titre d'annonce</h3>
                            <p>prix 200</p>
                            <p>surface 400</p>
                        </div>
                        </div>  
                </div>
    </div>
</div>
    <?php include('footer.php'); ?>
<script src="js/jquery.js"></script>
<script src="js/bootstrap.min.js"></script>
</body>
</html>

主屏幕应如下所示:

enter image description here

0 个答案:

没有答案