Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/234.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 获取列表标记中while循环中的数据 while($recor1=mysql\u fetch\u assoc($res1)) { ?>_Php_Css - Fatal编程技术网

Php 获取列表标记中while循环中的数据 while($recor1=mysql\u fetch\u assoc($res1)) { ?>

Php 获取列表标记中while循环中的数据 while($recor1=mysql\u fetch\u assoc($res1)) { ?>,php,css,Php,Css,你的代码有很多问题,为什么你要为每个项目添加一个只有一个列表项的新列表,这是没有意义的。也不要在内联元素(a中的div)中添加块元素。另外,如果你在列表项之间添加了什么,那么为什么要添加col-…类 while($recor1=mysql_fetch_assoc($res1)) { ?> <ul>

你的代码有很多问题,为什么你要为每个项目添加一个只有一个列表项的新列表,这是没有意义的。也不要在内联元素(a中的div)中添加块元素。另外,如果你在列表项之间添加了什么,那么为什么要添加col-…类

while($recor1=mysql_fetch_assoc($res1))
                            {

                              ?>
                                <ul>
                                <li  class="col-md-3 col-sm-3"><a href="#"><div class="dest-list"><?php echo $recor1['sub_destination']; ?></div></a> </li>

                                </ul>
                                <div class="clearfix"></div>
                              <?php 
                            }

这为您提供了正确的html结构,如果您不想水平显示列表,您可以根据自己的喜好对其进行样式设置。删除li的col-sm-3类,这将更改您的代码,如下所示

<ul>
<?php while($recor1=mysql_fetch_assoc($res1)) {?>
    <li class="">
        <a href="#">
            <?php echo $recor1['sub_destination']; ?>
        </a>
    </li>
<?php } ?>
</ul>
while($recor1=mysql\u fetch\u assoc($res1)){>

你用什么来表示李的col-md-3?谢谢,也许你可以接受我的回答,以防其他人偶然发现这个问题。。。
  while($recor1=mysql_fetch_assoc($res1)) { ?>

  <div class="col-md-3 col-sm-3">
   <ul>
    <li >
        <a href="#">
            <div class="dest-list">
                 <?php echo $recor1['sub_destination']; ?>
            </div>
        </a> 
    </li>
  </ul>
 </div>

 <div class="clearfix"></div>

 <?php 
 }