display records in table

前端 未结 3 843
感情败类
感情败类 2021-01-26 12:52

I am having some trouble with my first PHP project, I am trying to get the data from MySQL database (Has 3 records) and display it in tables. Problem is it only seem to display

3条回答
  •  一个人的身影
    2021-01-26 13:26

    you are using two while loop which is unnecessary use following code

    if (mysqli_connect_errno())
          {
          echo "Failed to connect to MySQL: " . mysqli_connect_error();
          }
    
          echo "";
    
    
    echo "";
    $result = mysqli_query($con,"SELECT * FROM unitstats");
    
    while($row = mysqli_fetch_array($result))
      {
    
    
    echo "";
      echo "";
      echo "";
      echo "";
    }
      echo "
    ID Name
    " . $row['id'] . "" . $row['name'] . "
    ";

提交回复
热议问题