View Full Version : PLS Help !!!! Coding

09-15-2003, 03:16 PM
how to display the page when the Database date is = to the system date?? eg. '$date' = date");

$hour = date("H");
$min = date("i");
$date = date("l");
$Connect = mysql_connect('localhost','root','');
$result=mysql_query("SELECT * FROM student WHERE '$hour:$min' > before AND '$hour:$min' < after AND '$date' = date");
echo"<form name=main method=POST action=verify_attendance.php>";

09-15-2003, 03:58 PM
You need to read our posting guidelines section 2


09-15-2003, 04:45 PM
You could use the MySQL function CURDATE(), like
$result=mysql_query("SELECT * FROM student WHERE '$hour:$min' > before AND '$hour:$min' < after AND date = CURDATE()");

But the rest of the code also looks strang (and probably wount work either). I suppose before, after and date are columnnames of table student (how bizare, but hey ...) where the two first are time-type and tha last is of type date AND that you want the record with date = the current date , and the current time between before and after.
Rigth ?

Then you can use
$result=mysql_query("SELECT * FROM student WHERE before < CURTIME() AND after > CURTIME() AND date = CURDATE()");

Note : CURTIME() and CURDATE() are MySQL functions, and will use the datetime from the server where the MySQL server runs on. In most cases, this is the same machine (or is a machine with the same systemdate) as where the webserver runs on

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum