I want to convert mysql table data into json but unfortunately it does not return anything.
<?php
$con=mysqli_connect("localhost","truem_apps","censored","truemarlon_apps");
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$sql = "SELECT * FROM saechsisch";
if ($result = mysqli_query($con, $sql))
{
$resultArray = array();
$tempArray = array();
while($row = $result->fetch_object())
{
$tempArray = $row;
array_push($resultArray, $tempArray);
}
echo json_encode($resultArray);
}
mysqli_close($con);
?>
My page is just blank what am I missing here?