Sorry, the app that Iām generating right now is part of my thesis thatās why Iām really eager to solve the problem quickly. Iām currently adjusting the php file right now. This JSON is really new to me thatās why I always got this error since last week.
I already knew whatās the valid json. The only problem is how I will correct it through php. This is my code:
$conn = new mysqli($host,$username,$password,$dbname);
$data = mysqli_query($conn, "SELECT * FROM bus WHERE Bus_Dep_Time='9:30 AM' AND Bus_Branch='Calbayog'");
$array = array();
while ($result=mysqli_fetch_assoc($data))
{
$array['bus'][]=$result;
echo json_encode($array);
}
I keep adjusting the $array[ābusā]=$result; but I always got the wrong json
$conn = new mysqli($host,$username,$password,$dbname);
$data = mysqli_query($conn, "SELECT * FROM bus WHERE Bus_Dep_Time='9:30 AM' AND Bus_Branch='Calbayog'");
$array = array();
while ($result=mysqli_fetch_assoc($data))
{
$array[]['bus'][]=$result;
}
echo json_encode($array);