简体   繁体   English

显示来自数据库的数据(并排)

[英]Display the datas coming from database (side by side)

show http://img28.imageshack.us/img28/3052/unledcwk.png 显示http://img28.imageshack.us/img28/3052/unledcwk.png

this is my html and the name and the picture is taken from php (mysql).I only want to make 3 of these things(name and picture) side by side not like a queue.So i want the name asdasddasd is in the right of the asdasd. 这是我的html,名称和图片取自php(mysql)。我只想将这些东西中的3个(名称和图片)并排而不是队列。所以我想要名字asdasddasd在右边asdasd。

<?php 
    echo '<div class="box">';
      $kategori=$_GET["kategori"];
      $con = mysql_connect("localhost","root","root");
        if (!$con){die('Could not connect: ' . mysql_error());}
            mysql_select_db("marmaris", $con);
            $bilgi= mysql_query("SELECT * FROM $kategori ");
            while($sutun= mysql_fetch_array($bilgi))
            {

                $name=$sutun["name"];
                $resb=$sutun["resbuyuk"];
                echo '<a href="#"><div id="texttitle">'.$name.'</div></a>';
                echo '<img src="upload/'.$resb.'" width="202" height="154" alt="resim" style="background-color: #000000" />';
                echo  '<div id="textdetailup"><a href="#">Detayları görmek için tıklayın.</a></div>';
            }

       echo '</div>';
       ?>

this is the code that makes them.How can i make the side by side showing. 这是制作它们的代码。我怎样才能并排显示。

this is the css of the box 这是盒子里的css

.box {
margin-bottom: 10px;
margin-right: 10px;
float: left;
height: auto;
width: 207px;
}

The div you are using to display the image subtext is a block level element so it is pushing the content to the next line. 用于显示图像子文本的div是块级元素,因此它将内容推送到下一行。

You need to put echo '<div class="box">'; 你需要把echo '<div class="box">'; inside the while loop, along with the corresponding </div> 在while循环中,以及相应的</div>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM