There are multiple issues with your current code.
- You fetch the first row with
$row = mysqli_fetch_array($select);
(line 3), but you don’t do anything with it. This means that the first result is discarded. - Your
while
loop attempts to loop over an incorrect variable ($query
is a string, not the result-object), and you’ve quoted it into a string – you need to do it as you were with the first fetch (line 3). - You don’t do anything inside your loop, so the results aren’t printed. At the very least, you should print them with
echo
.
$query = "SELECT * FROM table1";
$result = mysqli_query($connection, $query);
while ($row = mysqli_fetch_array($result)) {
echo $row["column1"]."<br />\n";
}
0
solved How to loop table in php [duplicate]