I need to check date + 1 month from DB with correct date. I try:
$todayDate = date("Y-m-d");
$dateOneMonthAdded = strtotime(date("Y-m-d", strtotime($todayDate)) . "+1 month");
$result = mysql_query('SELECT UNIX_TIMESTAMP("date") AS date FROM followform WHERE id = "28"') or die(mysql_error());
$date = mysql_fetch_assoc($result);
if ($dateOneMonthAdded == $date['date']) echo 'nice';
But $date[‘date’] == 0
If I use – mysql_query('SELECT date FROM followform WHERE id = "28"')
$date['date'] == 2012-08-13
Where is my mistake?
UNIX_TIMESTAMP("date")should beUNIX_TIMESTAMP(date). With the quotes in there, it’s trying to convert the literal string “date” to a timestamp.