this PHP script should not insert the same value🙂 but why it still inserting duplicate value. Anybody can help us!
if ($_POST['Insert']) {
while($row=mysql_fetch_array($selectQuery))
{
// echo $i++ ."**". $row['homeTel'] . "<br>";
$homeTel=$row['homeTel'];
foreach ($matches[0] as $u => $landlord)
{
$matches1 = $matches[1][$u];
// echo "<br>Name: " . $matches1;
$matches2 = htmlspecialchars($matches[2][$u],ENT_QUOTES);
// echo "<br>Add: " . $matches2;
$match0 = $match[0][$u];
// echo "<br>tel: " . $match0;
if (($match0 != $homeTel) || ($matches2 != 'NULL'))
{
$insertQuery="insert into ".homerentaltable."(homeName,homeAddress,homeTel)
values('$matches1','$matches2','$match0')";
mysql_db_query($database_name,$insertQuery) or die ("Failed " . $insertQuery);
}
}
}
} 2