PHP随着记录数量的增加动态增加#行

I'm Trying to fetch data from MySQL database. I want to increase number of row as data increase in database, but the Title Row should be only one. Like typical table but here just need to increase #row dynamically.

    <?php 
    mysql_connect ("localhost","root","root123"); 
    mysql_select_db ("iterrordb"); 

    $sql = "select * from record"; 
       $result = mysql_query ($sql); 
        $num=mysql_numrows($result);
        while ($row = mysql_fetch_array($result)) 
              { 
              $RecID= $row["RecordID"]; 
              $DispName= $row["Name"]; 
              $date= $row["date"]; 
              $fleet= $row["phone"]; 
              $issue= $row["issue"]; 
              $issueRelatedTo= $row["issuRelatedTo"]; 
              } 
        //HTML CODE is start from here

        echo "<table border=\"1\" bordercolor=\"#0066FF\" style=\"background-color:#CCFFFF\" width=\"50%\" cellpadding=\"1\" cellspacing=\"0\">";
        echo"<tr>";
        echo"<td>Record ID</td>";
        echo"<td>Name</td>";
        echo"<td>Date</td>";
        echo"<td>Phone</td>";
        echo"<td>Issue</td>";
        echo"<td>Issue Related To</td>";
        echo"</tr>";
        echo"<tr>";     
        for ($i=0; $i<6; $i++)  
            {
                echo"<td> $row[$i]</td>";
            }
        echo"</tr>";

        echo"</table>";

?>

Re-Write your code as

<?php 
mysql_connect ("localhost","root","root123"); 
mysql_select_db ("iterrordb"); 

$sql = "select * from record"; 
   $result = mysql_query ($sql); 
    $num=mysql_numrows($result);
    //HTML CODE is start from here

    echo "<table border=\"1\" bordercolor=\"#0066FF\" style=\"background-color:#CCFFFF\" width=\"50%\" cellpadding=\"1\" cellspacing=\"0\">";
    echo"<tr>";
    echo"<td>Record ID</td>";
    echo"<td>Name</td>";
    echo"<td>Date</td>";
    echo"<td>Phone</td>";
    echo"<td>Issue</td>";
    echo"<td>Issue Related To</td>";
    echo"</tr>";

        while ($row = mysql_fetch_array($result)) 
          { 
          $RecID= $row["RecordID"]; 
          $DispName= $row["Name"]; 
          $date= $row["date"]; 
          $fleet= $row["phone"]; 
          $issue= $row["issue"]; 
          $issueRelatedTo= $row["issuRelatedTo"]; 
          echo"<tr>"; 
         for ($i=0; $i<6; $i++)  
        {
            echo"<td> $row[$i]</td>";
        }
        echo"</tr>";
       }
    echo"</table>";

 ?>

the following code does not seem relevant, in current context but anyway I did not remove it

      $RecID= $row["RecordID"]; 
      $DispName= $row["Name"]; 
      $date= $row["date"]; 
      $fleet= $row["phone"]; 
      $issue= $row["issue"]; 
      $issueRelatedTo= $row["issuRelatedTo"]; 

I am not sure of what you mean. But if you want to have the number of row in your query result, this will do the trick :

$num_rows = mysql_num_rows($result);

if you want to know what is the current row number in your "while" loop, just add an iterator.

If you want to update dynamically your html table. Use jQuery :

$('#my_table').empty().load("/examples/getTableRows.php");

You could call this function like every 5 seconds to update the table.