I want to check two tables if all their contents are similar and echo yes or no Similarity. my PHP script is not work:
<?php
$path = $_SERVER['DOCUMENT_ROOT'];
include($path."db.php");
$sql = "SELECT *
FROM thprtins";
$sqlt = "SELECT *
FROM thirdparty";
$result = $conn->query($sql);
$resultt = $conn->query($sqlt);
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
$id = "" . $row["id"] . "";
$expiry = "" . $row["expiry"] . "";
$type = "" . $row["type"] . "";
$financial = "" . $row["financial"] . "";
$coid = "" . $row["coid"] . "";
echo "$id.$expiry.$type.$financial.$coid<br>";
}
}
if ($resultt->num_rows > 0) {
while($rows = $resultt->fetch_assoc()) {
$idd = "" . $rows["id"] . "";
$expiryy = "" . $rows["expiry"] . "";
$typee = "" . $rows["type"] . "";
$financiall = "" . $rows["financial"] . "";
$coidd = "" . $rows["coid"] . "";
echo "$idd.$expiryy.$typee.$financiall.$coidd<br>";
}
}
if ($result === $resultt)
echo "Two tables are similar";
else {
echo "no Similarity ";
};
?>
I have a main table and a backup table and somewhere I just change the backup table. If the two tables are not equal, I want to do the equalization operation.
Although the content in the two tables rows is different, the output is: Two tables are similar