$conn = new mysqli($servername, $username, $password, $dbname); // Check connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } echo "LISTA ORIGIAL
"; $sql_David_original = "SELECT * FROM Ttabela"; $result_David = $conn -> query($sql_David_original); while($row0 = $result_David -> fetch_assoc()) { echo $row0["ID"] . "
"; } echo "
LISTA NOVA
"; $num_rows = $result_David -> num_rows; for($i = 0; $i < $num_rows; $i++) { echo $i . "
"; }