[Solved] How to prevent duplication entry within certain time?

[ad_1]

You just have to check the old records for the cleaner on the particular date. Use the following script to get the old records with the date:

$prevRecordsQuery= "SELECT COUNT(*) AS records FROM `bookings` WHERE `date` = $date AND `cleaner` = '$_post[cleaner]'";

$prevRecords = mysql_query($query);

if($prevRecords)
      echo "This cleaner is fully booked";
else{
     $query = "INSERT INTO bookings ( uid, empname, date, custname, cleaner, address) VALUES ('$uid', '$empname', '00:00:00', '$_post[custname]', '$_post[cleaner]', '$_post[address]')";
     $result = mysql_query($query);

}

2

[ad_2]

solved How to prevent duplication entry within certain time?