I want to insert some values into the db, but before inserting them into I want to make sure that there is no duplicate entry for same user against same offername
and for current date
I am using this query and is working fine for userid
and date
//checking for existing values
$sql11=$Db1->query("SELECT COUNT(userid) AS total FROM TABLE where userid='$userid' and date BETWEEN (NOW() - INTERVAL 1 DAY) AND NOW()");
$temp=$Db1->fetch_array($sql11);
$thismemberinfo['count']=$temp[total];
//
if ($thismemberinfo['count'] >= 1 )
{ WARN HERE for duplicate entry}
else
{ INSERT TO DB }
I want to include offername
into checking as well
something like that
SELECT COUNT(userid) AS total FROM TABLE where userid='$userid' and offername= '$offername' date BETWEEN (NOW() - INTERVAL 1 DAY) AND NOW()
Kindly Suggest a work around for this problem