我在mysql上进行查询,其中condition是从今天起4天后具有journeydate的所有行。
但我的脚本不起作用,在我的datatable中,日期格式是dd/mm/yyyy,列类型是“varchar”。
当我执行这些查询时,得到包含所有日期的行,条件不起作用。
下面是sql脚本
include('../../connect.php');
$date = strtotime("+4 day", time());
$finaldate = date('d/m/Y', $date);
echo $finaldate;
//$sql = "SELECT * FROM tblapps WHERE pay_status <> 'paid' AND appstatus <> 'Not Interested' AND process = 'yes' AND journeydate >= '$finaldate'";
$sql = "SELECT * FROM tblapps WHERE journeydate >= '$finaldate'";
if($result = mysqli_query($connect, $sql)){
if(mysqli_num_rows($result) > 0){
echo "
echo "
";
echo "
id";
echo "
Pay Status";
echo "
Journey date";
echo "
email";
echo "
";
while($row = mysqli_fetch_array($result)){
echo "
";
echo "
" . $row['id'] . "";
echo "
" . $row['pay_status'] . "";
echo "
" . $row['journeydate'] . "";
echo "
" . $row['email'] . "";
echo "
";
}
echo "
";
// Free result set
$rowcount=mysqli_num_rows($result);
echo $rowcount;
mysqli_free_result($result);
} else{
echo "No records matching your query were found.";
}
} else{
echo "ERROR: Could not able to execute $sql. " . mysqli_error($link);
}
// Close connection
mysqli_close($link);
?>