Got stuck in a complex or maybe stupid problem. I am getting a query from mysql, and then trying to compare a date column with a PHP data which i formatted to the same format i.e "Y-m-d" it always results in no match, although i see there is a match.. and it gets the right result set too.
<?php
date_default_timezone_set('America/Los_Angeles'); // set timezone to our timezone
$constantTime = time(); // get value of time in constant
$appDate = date("Y-m-d", $constantTime); //that defines php time variable - 
$queryDate = "SELECT * FROM date WHERE date='$appDate'";
$resultDate = mysql_query($queryDate) or die("Sorry Website Under Maintainence");
$recordDate = mysql_fetch_array($resulDate);
if ($appDate == date("Y-m-d", strtotime($recordDate['date']))) {
    echo "MATCH    ";
    $dateID = $recordDate['dateID'];
} else {
    mysql_query("insert into date(date) values('$appDate')")or die("Database write error1");
    $resultDate = mysql_query($queryDate) or die("Sorry Website Under Maintainence");
    $recordDate = mysql_fetch_array($resultDate);
    echo "NO MATCH ";
    $dateID = $recordDate['dateID'];
}
This is always triggering the else, i tried === instead of ==, i tried strcmp