How can I find database records that were NOT just updated

From: Date: Mon, 20 Nov 2000 02:01:47 +0000
Subject: How can I find database records that were NOT just updated
Groups: php.general 
Request: Send a blank email to php-general+get-26091@lists.php.net to get a copy of this message
OK, let me first explain what I'm trying to do: I have a table with about 100 records. Each record has a unique ID. A script then adds records to this table, or updates the record if it already exists (based on the ID). I then need to get a list of all the records that were NOT just inserted or updated. The only way I can think of to do this is as follows: I define two single dimension arrays: the first one ($array1) contains the ID's of every record in the table before it is updated the second one ($array2) conatins the ID's of every record that was inserted or updated I then do something like: $i = 0; while ($array1[$i]){ $j = 0; while ($array2[$j]){ if ($array1[$i] == $array2[$j]){ < delete $array1[$i] from $array1 > } $j++; } $i++; } This way though, I have to traverse array2 once for every element in array1. With both arrays being ~100 elements (and they will grow), this will take some time. Anybody have a more efficient way of doing this? Thanks, Chris -- "Without the threat of death, there's no reason to live at all" - Marilyn Manson

« previous php.general (#26091) next »