-1
$sql=mysql_query("SELECT day='$day','$month' day='$day' year='$year' FROM punchin WHERE pass='$pass' '$month' AND day='$day' AND year='$year' ");
if (mysql_num_rows($sql) === 0) {
mysql_query("INSERT INTO punchin (count,pass,month,day,year,time,wday) values (null,'$pass','$month','$day','$year','$time','$wday')") or die(mysql_error());
t
}else
echo "<a href='loginoption.php'>You can only punch-in once a day!</a>";
問題是.. 員工應該每天只打一次,但這個人可以隨時打點。如何選擇和查看是否有記錄?
'SELECT天='$ day''錯誤的語法。選擇的這一部分沒有'='。 – developerwjk 2015-03-02 22:32:08
假設你正在使用MySQL,SELECT語句的語法是[記錄在這裏](http://dev.mysql.com/doc/refman/5.6/en/select.html) – 2015-03-02 22:33:23
但是,如果你只是學習,學習使用[MySQLi](http://www.php.net/manual/en/book.mysqli.php)或[PDO](http://www.php.net/manual/en/book .pdo.php)與[prepared statements and bind variables]接口(http://php.net/manual/en/mysqli.quickstart.prepared-statements.php),因爲MySQL接口將[從PHP正式退出] (http://php.net/manual/en/migration55.deprecated.php)在年底之前 – 2015-03-02 22:34:22