0
I have this php code that printed the array of select mysql output:
He currently prints the name, date and end time and start of the event.
How I would add an item to the array, such as the "id" of each record?
header('Content-Type: application/json');
$start = mysqli_real_escape_string($connection,$_GET["start"]);
$end = mysqli_real_escape_string($connection,$_GET["end"]);
$result = mysqli_query($connection,"SELECT `id`, `start` ,`end` ,`title`,`ativo` FROM `events` where (date(start) >= '$start' AND date(start) <= '$end' AND ativo='nao' ) ");
while($row = mysqli_fetch_assoc($result))
{
$events[] = $row;
}
echo json_encode($events);
exit;
In this example, it seems that you are already returning the full line within the array (with all values defined in the select of sql). How exactly is the result being shown?
– ThiagoYou