compare values in 2 array
| From: | weetat | Date: | Fri, 28 Jul 2006 10:42:06 +0000 |
| Subject: | compare values in 2 array | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-239847@lists.php.net to get a copy of this message | ||
Hi all ,
I am using PHP 4.3.2 and MYSQL DB.
I need to compare values in array which populated by database , below is the code :
$temp_tbl = array();
while ($row = $temptbl_result->fetchRow(DB_FETCHMODE_ASSOC)){
$rs_chasis_serialno = $row['serial_no'];
$rs_card_serial_no = $row['card_serial_no'];
$rs_country = $row['country'];
$status = $row['status'];
$temp_tbl[] = array("chassis_serial_no"=>$rs_chasis_serialno,
"card_serial_no"=>$rs_card_serial_no,
"country"=>country
"status"=>status);
}
$current_tbl = array();
while ($row = $currenttbl_result->fetchRow(DB_FETCHMODE_ASSOC)){
$rs_chasis_serialno = $row['serial_no'];
$rs_card_serial_no = $row['card_serial_no'];
$rs_country = $row['country'];$current_tbl[] = array("chassis_serial_no"=>$rs_chasis_serialno,
"card_serial_no"=>$rs_card_serial_no,
"country"=>country);
}
--> need to compare $temp_tbl array and $current_tbl array.
--> if values is different between 2 array , need to update the status field in the $temp_tbl array.
Anybody have any suggestion how to do this ?
Thanks