I am trying to write a script for my site that will check if a user has submitted a review for a particular cigar in the past 30 days and if they have, prevent them from creating a new review. I am trying to figure out the code but I'm getting stuck on how to calculate the 30 days from today's date? Any help?
Here's what I have now -
<?PHP
$SQL = "SELECT max(DateAdded) from reviews_cigar WHERE $UserID = UserID AND $CigarID = CigarID";
$Result = mysql_query($SQL)
If ($Result < ?????) {
echo "Sorry but you've submitted a review for this cigar in the past 30 days"
}
?>