I'm trying to iterate through all the rows in a MYSQL table given the column name. I'm looking through the PHP docs and StackOverflow questions, but for some reason the while
loop method didn't exactly work. Here's what I have so far:
include 'dbcon.php';
$dbcon = getConnection();
$currentUser= $_COOKIE['currentUser'];
$getIpQuery = mysqli_query($dbcon, "SELECT $currentUser FROM ipList");
$row = mysqli_fetch_array($getIpQuery, MYSQLI_NUM);
printf(count($row));
for($x=0;$x<count($row);$x++)
{
printf("%s", $row[$x]);
}
This code returns only the first entry in the table which looks like this
--------------------
placeholder user //(same as $currentUser)
NULL value1
NULL value2