Nice tip Paul.
Weetat, I'm a bit concerned about your data as I look at it, and think
the approach I mentioned before needs a rewrite:
Do you have a a "primary key" in your arrays/rows? Meaning, how can
you tell if the two arrays you're comparing are just plain
_different_, or simply out of synch? Is it your card_serial_no? or
card_model? Or another column (like 'id') that you're not passing?
The point is, you need to know which is your "primary key" column and
do your testing based on these.
Then I think your whole update/new/delete/skip process might require
two passes: One to handle the update/skip assignments, and another for
the new/delete assignments. Use a combo of array_intersect() and
array_diff() to help you figure out what needs what...
HTH,
John W
On 7/29/06, Paul Novitski <[EMAIL PROTECTED]> wrote:
At 12:20 AM 7/29/2006, Paul Novitski wrote:
>You might consider concatenating all the elements in each sub-array
>to make the comparison logic simpler, e.g.:
>
> foreach ($currenttablearr as $key => $subarray)
> {
> $comparisonArray[$key] = explode("_", $subarray);
> }
>
>This would result in:
>
> $comparisonArray[0] == "1235_Malaysia_cd-12345_ws8950"
> $comparisonArray[1] == "1235_Singapore_cd-890_ws1234"
Sorry, of course I meant implode(), not explode()!
http://php.net/implode
Paul
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php