Hi to all,
I have multidimensional array and want find the duplicate values
array(2) {
[1]=>
array(3) {
[0]=>
string(19) "2013-02-04 02:48:00"
[1]=>
string(19) "2013-02-05 08:48:00"
[2]=>
string(19) "2013-02-06 21:48:00"
}
[2]=>
array(9) {
[0]=>
string(19) "2013-02-04 01:48:00"
[1]=>
string(19) "2013-02-04 02:48:00"
[2]=>
string(19) "2013-02-04 22:48:00"
[3]=>
string(19) "2013-02-05 05:48:00"
[4]=>
string(19) "2013-02-05 08:48:00"
[5]=>
string(19) "2013-02-05 22:48:00"
[6]=>
string(19) "2013-02-06 02:48:00"
[7]=>
string(19) "2013-02-06 08:48:00"
[8]=>
string(19) "2013-02-06 22:48:00"
}
[4]=>
array(9) {
[0]=>
string(19) "2013-02-04 01:48:00"
[1]=>
string(19) "2013-02-04 08:48:00"
[2]=>
string(19) "2013-02-04 22:48:00"
[3]=>
string(19) "2013-02-05 02:48:00"
}
}
I have two database table for example table1 and table2
table1 has following fields
t1_ID Start_date
table2
t2_ID service_id t1_ID
i want to insert the duplicate start_date once in table1 and then the id of that record in table2
For example in above array
arr[1][0]
arr[2][1]
arr[4][3]
has same start date which is 2013-02-05 02:48:00 i want to put this in table1 once like
t1_ID start Date
1 2013-02-05 02:48:00
Now in table2
t2_ID service_ID t1_ID
1 1 1
2 2 1
3 4 1
Its mean in table2 subarray which has duplicate values will be inserted against it along the service id which is the index of the array which we are setting .
thanks.