Link to home
Start Free TrialLog in
Avatar of BR
BRFlag for Türkiye

asked on

PHP sql data selection and compare

// I have problem. it does not take tha date and assign it to the  $date_comingfrom_database
what should I do?

$query = "SELECT Email,Date FROM Mytable where Email='$visitoremail'";
$sql=mysql_query($query);
$result = mysql_fetch_array($query); // I have error message Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /
// I have problem here it does not take tha date and assign it to the  $date_comingfrom_database

$date_comingfrom_database = $result['Date'];
$databaseemail =$result['Email'];

$todaysdate = date('Y-m-d H:i:s');

if ( ( strtotime('Y-m-d H:i:s') - strtotime($date_comingfrom_database) >= 50 ) && ($databaseemail = $visitormail))
{
echo "record exist."  . $date_comingfrom_database . " ".$databaseemail. " ".$visitormail    ;
}
else
{
echo "record not exist." . $date_comingfrom_database . " ".$databaseemail. " ".$visitormail    ; // it only writes record not exist. and $visitormail here
}

I'll be back in 25 minutes..
ASKER CERTIFIED SOLUTION
Avatar of Snarfles
Snarfles
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of BR

ASKER

you are great,
thank you
You're welcome :)