@$db = mysql_connect("localhost", "pcidb_user", "pciuser");
mysql_select_db("smisdb");
$sql = "select * from logbook where CodeName='".$code."' and LogInTime = LogOutTime and LogInDate = '".date(Y."-".m."-".d)."'";
$result = mysql_query($sql);
if ($row = mysql_fetch_row($result)) {
<--- This is the one ... I don't know if it helps, though. I also agree that it's not about the platform, but I'm suspecting the validity of the mysql 4.0 I use. I downloaded it during the time it just came out. Not sure if it works correctly.