With the array_diff() function, you can compare 2 arrays and get the difference between the two of them. The code below takes ids from one table and compares it to the ids of another table.
## Get second array
$command2 = “SELECT * FROM table2 “;
$result2 = mysqli_query($db, $command2);
$rows_count = mysqli_num_rows($result2);
if($rows_count >0) {
while($row = mysqli_fetch_assoc($result2)) {
$id = $row[‘id’];
## Make an array of all ids
$id2[] = $id;
}
}
else{
$id2[]=0;
}
## CCompare teh difference of the ids in the 2 tables
$result_diff = array_diff($1id, $id2);
© 2018 ALL Rights Reserved | Sitemap
Vancouver | North Vancouver | Burnaby | Richmond | Coquitlam | Port Coquitlam | Surrey | Langley | Maple Ridge | Mission | Abbotsford | Kamloops | Kelowna | Victoria | Squamish | Whistler | Pemberton