Reputation: 460
I am using the following sql statement:
$sql = "INSERT INTO counter (uid, placeid, lastdate) VALUES
('" . $uid . "', '" . $place->place->id . "', '" . $added . "')
ON duplicate KEY UPDATE count = count + 1`";
This keep tracks of how many times people check in. I do not want multiple check ins a day, so when if someone checks in twice a day we do not record it.
If $added = lastdate, I do not want to update the count.
Can this be done with a sql statement?
Upvotes: 2
Views: 115
Reputation: 839224
This should work:
"INSERT INTO counter (uid, placeid, lastdate) VALUES
('" . $uid . "', '" . $place->place->id . "', '" . $added . "')
ON duplicate KEY UPDATE count = count + ('" . $added . "' <> lastdate)"
Upvotes: 1