I have an array that contains items for an employee. Some employees have more than one record, therefore have more than one array. example. There could be a max of 5 records.
[7] => Array
(
[emp_num] => 13
[emp_name] => SMITH, BILL
[appropriation1] => 51000550000
[hours1] => 80.00
[sal/rate1] => 500.00
[default_pay] => Y
[total_hours] => 82.00
[gross] => 537.50
)
[8] => Array
(
[emp_num] => 13
[emp_name] => SMITH, Bill
[appropriation1] => 51000550005
[hours1] => .00
[sal/rate1] => .00
[default_pay] =>
[total_hours] => 82.00
[gross] => 537.50
)
The [appropriation1],[hours1],[sal/rate1] are the only thing that will repeat. So I want to end up with
[7] => Array
(
[emp_num] => 13
[emp_name] => SMITH, BILL
[appropriation1] => 51000550000
[appropriation2] => 51000550005
[appropriation3] => 51000550005
[appropriation4] => 51000550005
[appropriation5] => 51000550005
[hours1] => 80.00
[hours2] => .00
[hours3] => .00
[hours4] => .00
[hours5] => .00
[sal/rate1] => 500.00
[sal/rate2] => .00
[sal/rate3] => .00
[sal/rate4] => .00
[sal/rate5] => .00
[default_pay] => Y
[total_hours] => 82.00
[gross] => 537.50
)
Would this be easier to do in sql? I only know basic sql, but if I join the table to itself would I be able to create columns rather try to manipulate an array? Or even make a view?
Heres the basic sql
select employeenumber,EMPLOYEENAME, APPROPRIATION, TOTALHOURS as hours, PAYSALRATE, DEFAULTPAYCODE
from DET
where RECTYPEIND = 'D'