0
$appr2 = mysql_query("SELECT from_date FROM mrfs WHERE `mrf_id`='$row[0]'") or die (mysql_error());
			$appr3=mysql_fetch_row($appr2);
				$appr4 = mysql_query("SELECT to_date FROM mrfs WHERE `mrf_id`='$row[0]'") or die (mysql_error());
			$appr5=mysql_fetch_row($appr4);
			$date=date("m/d/Y");
			$date1=date("m/d/Y", strtotime("$appr3[0] -8 days"));
			
			if($date>=$date1 && $date<=$appr5[0] )

The code above says to compare two dates present date and from date
and present date and to date.
this works fine if i select any date in 2011 but not if i select any date in 2012 after changing 8 to any other value.
Pls help....

2
Contributors
1
Reply
2
Views
5 Years
Discussion Span
Last Post by fobos
0

Your going to have to post more of your codeing, because on line 1

$appr2 = mysql_query("SELECT from_date FROM mrfs WHERE `mrf_id`='$row[0]'") or die (mysql_error());

im guessing you are running a sql query prior to that one? If you dont mind i have a suggestion

$result = mysql_query("SELECT from_date,to_date FROM people WHERE mrf_id = '$row[0]'");
if (!$result) {
    echo 'Could not run query: ' . mysql_error();
    exit;
}
$row = mysql_fetch_row($result);
$date = date("m/d/Y");
$from_date = date("m/d/Y", strtotime($row[0]-8 days"));
$to_date = $row[1];
if($date >= $from_date && $date <= $to_date) {

}
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.