ArcGames
06-21-2006, 05:47 PM
What I am trying to do is compare dates using php and a mysql database. A date taken from my mysql database and compare it with today's date, and if today's date is 14 days more then the date taken from the database, then for it to echo a response message on a webpage, or if it less then I need it to echo a certain response message on a webpage. Please tell me if this code will work, if not please help me fix it, please?
<?php
$CurDate = date("Y").date("d").date("m");
// Make a MySQL Connection
mysql_connect("localhost", "my_username", "my_password") or die(mysql_error());
mysql_select_db("my_database") or die(mysql_error());
$SignupDate_A = mysql_query("SELECT pdate FROM my_table") or die(mysql_error());
$SignupDate_B = strtotime($SignupDate_A);
$SignupDate = $SignupDate_B + 14;
if ($CurDate <= $SignupDate)
{
echo "You are below the expiration date";
}
elseif ($CurDate > $SignupDate)
{
echo "The Date has expired";
}
?>
Thanks!
<?php
$CurDate = date("Y").date("d").date("m");
// Make a MySQL Connection
mysql_connect("localhost", "my_username", "my_password") or die(mysql_error());
mysql_select_db("my_database") or die(mysql_error());
$SignupDate_A = mysql_query("SELECT pdate FROM my_table") or die(mysql_error());
$SignupDate_B = strtotime($SignupDate_A);
$SignupDate = $SignupDate_B + 14;
if ($CurDate <= $SignupDate)
{
echo "You are below the expiration date";
}
elseif ($CurDate > $SignupDate)
{
echo "The Date has expired";
}
?>
Thanks!