I am trying to print out some database entries into an associative array, but it's only printing the first entry.
This is my code
if (mysqli_num_rows($result) > 0) {
$data_array = array();
while($row = mysqli_fetch_assoc($result)) {
$data_array['name']=$row["name"];
$data_array['title']=$row["title"];
$date=date_create($row['published']);
$edited_date=date_format($date,"l, F d, Y");
$data_array['date']=$edited_date;
}
} else {
echo "0 results";
}
echo json_encode($data_array);