Only unshift first time, since the sql_param array would contain all device_id's if we unshift every time.
Only unshift first time.
Thankts @SaaldjorMike What does this actually fix?
@laf: Up until now it has been looping over all devices and fetching all rows in the services table for each device_id, but when there are multiple devices this would give:
Iteration 1: $sql_param = [device_id1, int, str]
Iteration 2: $sql_param = [device_id2, device_id1, int, str]
Since we use the array $sql_param when performing the query, we have not the correct value for service_status since $sql_param now contains some other $device_id instead of the integer which is set on line 26.
Hope this clarifies it a bit.