<?php
if($_SERVER['REQUEST_METHOD']=='POST'){
$staffID = $_POST['staffID'];
date_default_timezone_set("Asia/Singapore");
$checkInTime = $_SERVER['REQUEST_TIME'];
$today = date('Y-m-d');
require_once('dbconnect.php');
$sqlcheck = "SELECT * FROM StaffAttendacne WHERE StaffID = '$staffID' AND Date ='$today'";
$sql = "INSERT INTO StaffAttendance (StaffID,Date,CheckInTime) VALUES ('$staffID','$today','$checkInTime')";
$result = mysqli_query($con,$sqlcheck);
$check = mysqli_fetch_array($result);
if (isset($check)){
echo "You have already checked in";
}else {
echo"$checkInTime";
mysqli_query($con,$sql);
}
如何编写php插入检查时间(插入时间戳)到SQL数据库中。时间是应用程序启动时间。我写了这段代码但没有用
答案 0 :(得分:0)
您正在使用if (isset($check)){
,因为您已在其上方$check
定义mysqli_query($con,$sql);
,因此您的if(count($check) > 0)
未运行。
您应该使用 end.jmx(file: Dir.pwd+"/TestPlan.jmx") # Dir.pwd will give your current directory path