Jump to content

printf

Staff Alumni
  • Posts

    889
  • Joined

  • Last visited

Community Answers

  1. printf's post in Styling Comment Section from Database was marked as the answer   
    This looks like a PHP question, not a SQL question! Anyway, move the <table> out of the loop, and then just style your <tr> tag with a border-top or border-bottom.
     

            <td>         <table class='commenttable'>             <?php                 include '../Scripts/connection.php';                          $sql = "SELECT id, name, email, subject, comment FROM comment";             $result = $connect->query($sql);                          if ($result->num_rows > 0) {                 // output data of each row                 while($row = $result->fetch_assoc()) {                     echo "             <tr style=\"border-bottom: 1px solid #000;\">                             <td class='id'>                                 <u>Loyal Client ". $row["id"] . "</u>:                             </td>                             <td class='subject'>                                 " . $row["subject"]. "                             </td>                         </tr>                         <tr>                             <td></td>                             <td class='comment' colspan='2'>                                 " . $row["comment"]. "                             </td>                         </tr> ";                 }             } else {                 echo "            <tr>                 <td>                     No Comments                 </td>             <tr> ";             }             ?>         </table>         </td>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.