hi guys
I am writing a function which compares the date now with 2 dates using datetime on the data base mysql
can some one improve the the function as its not working properly no syntax errors a logical one me thinks
function check_date(now()) //systemdate
{
global $link;
$query="SELECT test_id FROM tests where now() between start_test and end_test";
$result=mysql_query($query, $link)
or die("date error fatal error: ".mysql_error());
// Check exactly one row is found:
if(mysql_num_rows($result)==1) {
$row=mysql_fetch_array($result);
return $row;
}
// either ealry or late....:
return false;
}
btw i call the function in like this
if( !($row = check_date(now() ) )
{
// Staff ID does not exist, create an error message:
$messages[]="Can not access test $test can not be accessed: THe time for this test has gone or not yet started ";
}
[/php
thanks for all ur help......