I have a database from which I retrieve information successfully.
//Connect to mysql database
$con = mysqli_connect($host,$user,$pass);
mysqli_select_db($con, $databaseName);
//Query database for data
$sql = "SELECT * FROM donators";
$result = mysqli_query($con, $sql);
I can send it to my browser by iterating print_r($row)
//this returns the result
while($row = mysqli_fetch_array($result))
{
print_r($row);
}
But when I try to retrieve it by iterating $row['lastName'] it does not return anything at all. It works on all other rows. This specific row contains peoples lastName. I am also 100% certain I wrote 'lastName' right.
//no result here but woudl work without "firstName"=>$row['firstName']
while($row = mysqli_fetch_array($result))
{
$output[]= array( "index"=>$row['index'], "firstName"=>$row['firstName'], "lastName"=>$row['lastName']);
}
echo json_encode($output);
Anyone has an idea what can be / is causing this?