我的查询很简单。
我有一个包含名称、id、日期、时间、输入、输出的表
我只想让 php 检查是否是 salman, 001, 12/12/2012, 12:12:12, 1, 0
然后插入 salman, 001, 12/12/2012, 05:12:12, 0, 1
只有 in 和 out 值需要改变,取决于员工是否在然后给出值 in = 0 和 out = 1 否则如果员工不在则给值 in = 1 和 out = 0
我被困在某个地方
$insertqr = mysql_query("SELECT * FROM at_daily where daily_qr = '".$q."' and daily_date = '$today' and daily_in = '0'");//'".$today."'");
$daily = mysql_fetch_array($insertqr);
if($daily['daily_in'] == 0){
mysql_query("INSERT INTO at_daily (daily_name, daily_qr, daily_date, daily_time, daily_in, daily_out)
VALUES ('$name', '$q', '$today', '$ttime', '$myzero', '$myone')");
echo "record entered of In";
}
else if($daily['daily_in'] == 1)
{
mysql_query("INSERT INTO at_daily (daily_name, daily_qr, daily_date, daily_time, daily_in, daily_out)
VALUES ('$name', '$q', '$today', '$ttime', '$myone', '$myzero')");
echo "record entered of Out";
}