为了账号安全,请及时绑定邮箱和手机立即绑定

一个字段中的多重打印值

一个字段中的多重打印值

PHP
慕婉清6462132 2021-05-13 13:08:18
我如何从mysql打印值,我在表中有一些主题,我需要将它们作为注释打印在同一行中。但是代码在做重复项,我也在表中插入了注释。$sql = "SELECT response.date,response.session, board.id as idboard, Jmeno,Koment,Text, Nazev as 'Nazev', Prezdivka as 'Prezdivka', board.Datum as 'Datel' FROM `board` left join users on board.ID_user=users.ID join response where response.ID_board=board.ID";$result = $conn->query($sql);if ($result->num_rows > 0) {    // output data of each row    while($row = $result->fetch_assoc()) {        echo "<div class='card'>  <div class='card-header' style='color:red;background-color:lightblue;'>" . $row["Nazev"]. " <a class='float-right'>Uživatel: " . $row["Prezdivka"]. "   Datum: " . $row["Datel"]. "</a></div>  <div class='card-body' style='background-color:lightgrey;'>" . $row["Text"]. "</div> </div> <a href='prikazy/detail.php?id='>Odpovědi<a><br>  " . $row["Koment"].  " <a style='color:pink;'>" . $row["session"].  " " . $row["date"].  " </a>  <form method='post' action='index.php'> <input type='hidden' name='idboard' value=" . $row["idboard"]. " >  <input type='text' class='form-control float-right' placeholder='Zadejte nový komentář...' name='komentar'>    <br><BR><button type='submit' class='btn btn-info float-right' name='komentovat'>Komentovat</button></form><br><hr>";    }} else {    echo "0 výsledků v DB";}
查看完整描述

2 回答

  • 2 回答
  • 0 关注
  • 125 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信