我有一个Java字符串表示的时间戳,想要与SQL进行比较并添加数据,但出现了解析错误,不知道为什么。请问有什么解决方法吗?
<?php
if($_SERVER['REQUEST_METHOD']=='POST'){
//Getting values
$number = $_POST['number'];
$type = $_POST['type'];
$date = $_POST['date'];
$content = $_POST['content'];
$start = strtotime("now");
$end = strtotime("-7 days");
while($start->format('U') > $date->format('U') > $end->format('U')){
$sql = "INSERT INTO message_detail (number,type,date,content) VALUES ('$number','$type','$date','$content')";
//Importing our db connection script
require_once('connect.php');
//Executing query to database
if(mysqli_query($con,$sql)){
echo 'Entry Added Successfully';
}else{
echo 'Could Not Add Entry';
}
}
//Closing the database
mysqli_close($con);
}
?>