我试图从mysql数据库检索数据到一个HTML表

1 html php mysql

几乎所有东西都工作正常,除了第一列,数据前面是"1".

这是我的输出:
第一列,即强度前面是1.我的数据库中的数据只是一个数字.

第一列,即strength,前面是1.我的数据库中的数据只是一个数字.

    <?php
    include 'index.php';
    $sql = "SELECT  t.strength, t.timeslot, t.cust_phno , c.fname, c.lname  FROM tables t,customer c WHERE t.cust_phno = c.cust_phno";
    $result = mysqli_query($con,$sql);
    ?>
    
  <div id="view">
    <table style="width:90%">
      <thead>
      <tr>

        <th> Table Strength </th>
        <th> Time Slot </th>
        <th> Customer Phone Number</th>
        <th> Customer Name </th>
      </tr>
    </thead>
    <tbody>
      <?php
      while( $array = mysqli_fetch_assoc($result)) {
        echo
        print "<tr> <td>";
      echo $array["strength"];
      print "</td> <td>";
      echo $array["timeslot"];

      print "</td> <td>";
      echo $array["cust_phno"];
      print "</td> <td>";
      echo $array["fname"];
      print "&nbsp";
      echo $array["lname"];


      print "</td> </tr>";


          }
        ?>


    </tbody>
  </table>
Run Code Online (Sandbox Code Playgroud)

Nig*_*Ren 5

1是回显来自print... 的结果,以下几行需要略有不同.

 while( $array = mysqli_fetch_assoc($result)) {
    echo
    print "<tr> <td>";
Run Code Online (Sandbox Code Playgroud)

你不需要回声......

 while( $array = mysqli_fetch_assoc($result)) {
    print "<tr> <td>";
Run Code Online (Sandbox Code Playgroud)