HI Everyone,
Having a bit of trouble with some array`s...
here is the situation:
I need to get the contents of 1 array and compare them to another array and if numbers from the 2nd array are in the first array, i want to unset it from the 2nd array.
so basically,
$arr1 = array('1','2','3','4','5','6','7','158','12');
$arr2 = array('2','5','4','8','12','6','7','154','124','131');
$arr1 comes from the table with figures in already, the line for line,
$arr2 comes from tickboxes and is the 1 i will use to update both tables,
there is a catch, I am updating 2 tables, 1 table accepts and array of figures while the other takes line for line input.
I need to update both.
So the 2nd array needs to be unchanged and update table 2 which accepts the string of figures and then i need to change it for the line for line update.
something i did before but i forgot to compare array`s so data gets duplicated in INSERT INTO.
foreach ($com as $i){
$sql_insert = "INSERT INTO `table1` (ID, CompID) VALUES ('{$id}', '{$i}')";
$rs_insert = dbconn($sql_insert);
}
foreach ($com as $t){
$up .= $t.",";
}
$output = substr($up, 0, -1);
$sql_upd = "UPDATE `table2` SET Computer = '".$output."' WHERE ID = '".$id."' ";
$rs_upd = dbconn($sql_upd);
echo "Updated.... Thank You!";
<script>location.href='example.php?ID=".$id."';</script>";
}
i know it is something simple... but any help is appreciated! :)