如何在所有行中显示特定列中的数据,并在 <p> 标记上循环该数据


How to display data from a particular column across all row and loop it on a <p> tag?

我只想显示数据库中名为"text_notes"的列的所有行的数据。我想在 p 标签中循环该数据,以便从第 text_notes 列开始的所有数据一一显示,直到最后。

下面是我尝试的代码,但它显示最新行的所有列,而不显示其他行。

我希望所有行中"text_notes"列中的数据从底部的最新到顶部的最旧显示。

<?php
          $query = "SELECT * FROM notes";
          $conn = new mysqli(DBROOT,DBUSER,DBPASS);
          $conn->select_db(DBNAME);
          if ($conn == TRUE) {
          $runQuery = $conn->query($query);
          $resultNum = $runQuery->num_rows;
          $result = $runQuery->fetch_array();
          $resultRow = mysqli_fetch_row($runQuery);
          $notes = $result['text_notes'];

          for ($i = 0; $i < $resultNum;) {
            echo "<p>".$resultRow[$i]."</p>";
            $i++;
          }
          }
        ?>
$mysqli = new mysqli(DBROOT, DBUSER, DBPASS, DBNAME);
$query = "SELECT text_notes FROM notes";
$result = $mysqli->query($query, MYSQLI_STORE_RESULT);
// Cycle through the result set
$counter = 0;
while(list($text_notes) = $result->fetch_row())
      echo "<p>";
      $counter++;
      echo $counter . " : "; 
      echo " $text_notes  </p>";
// Free the result set
$result->free();

我认为它:)有效谢谢