I need to fetch values from the database.
I am using my MySQL mysqli_fetch_assoc
with while loop
and I don't know the name of the columns.
I am getting null
value from the rows.
Here is my code:
$myQuery ='Select * from `tableName` ';
$query = $conn->query($myQuery);
while($row = mysqli_fetch_assoc($query))
{
$data[] = $row;
}
When I print this $data[]
array there are several null rows like this:
{
ID: null,
Car: null,
Phone: null,
State: null
},
{
ID: null,
Car: null,
Phone: null,
State: null
},
How can I avoid these null rows? I don't know the column names.