I'm trying to retrieve data from my table and save all the results in an array.
$query = " SELECT id,sent_to FROM `table` WHERE `ac` = 0 AND `cut` < CURRENT_DATE() ";
$result = mysqli_query($con,$query);
$sentToList = array();
while($row = mysqli_fetch_assoc($result)) { $sentToList = $row['sent_to']; }
print_r($sentToList); // to check if the results have been saved in the variable
$sent_to = explode(',', $sentToList); //for my next step
When I'm printing $sentToList I'm getting only the last result of the query. There are similar questions answered but I didn't quite get the explanation. Thank you.
while($row[] = mysqli_fetch_assoc($result)) { }