dongtiao0279 2013-08-16 04:19
浏览 21
已采纳

在div中显示行[duplicate]

This question already has an answer here:

I had asked this question but didn't clarify what I wanted. I want the rows from table be displayed inside the div. I just want to break each row inside the div so while the div is the main container with background then the rows should align vertical, without creating another border. just the whole thing inside the div.

       .message{
        border:2px solid;
        background-color:white;
        float:left;
        }

php

 $user = $_SESSION['username'];
 $mydb = new mysqli('localhost', 'root', '', '');
 $stmt = $mydb->prepare("SELECT * FROM messages where from_user = ?  ");
 $stmt->bind_param('s', $user);
 $stmt->execute();


$result = $stmt->get_result();
while ($row = $result->fetch_assoc()) {

echo"<div class='message'>";


echo $row['to_user']."<br/>";

echo"</div>";

}
</div>
  • 写回答

2条回答 默认 最新

  • doy2255 2013-08-16 04:21
    关注

    So div class="message" is the main container that you wnat all the content to be in rows inside of?

    $result = $stmt->get_result();
    
    echo"<div class='message'>";
    
    while ($row = $result->fetch_assoc()) {
    
            echo $row['to_user']."<br/>";
    
    }
    
    echo"</div>";
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器