PHP outputs mysqli row values outside while loop -
i trying output row values outside while loop this
$sql = mysqli_query($connection, "select username accounts rank='admin'"); while($row = mysqli_fetch_array($sql)) { $username = $row['username']; }
i output , print result outside while loop. tried print_r
doesn't seem work, shows last or first value not all.
you need save each value in array inside of while
loop.
while($row = mysqli_fetch_array($sql)){ //save in array $username[] = $row['username']; } //output values print_r($username);
you need brackets []
save each value array. $username[]
Comments
Post a Comment