php array_unique combined with array_filter, incorrect output
In a database table are multiple entries related to a customer. Each entry
will have time_1, time_2, time_3, time_4, time_5 and time_6 fields. I have
looped through the entries and used this to combine these times to create
a round cycle for a day:
while($row=mysql_fetch_assoc($script_check))
{
$prerounds = array_filter($row);
$rounds = array_unique(array_merge($prerounds));
}
This works however if one entry has times 1-4 set and the second entry has
times 1-3 set the fourth time will be totally removed thus only times 1-3
are put into the array. How can I combine these fields without losing data
when some are blank? Thanks.
No comments:
Post a Comment