I'm still new to programming especially in php and phpmyadmin and I have a quick question for a query I need to do in my php work, basically I want to compare the current date with the date which is in the expiration field of my table and get back all rows where the expiration field is greater than the current date.
here is my code:
function getnewsall(){
$conn = connecte();
$sql = "SELECT * FROM news WHERE CAST(expiration AS DATE) > CAST(GETDATE() AS DATE) ORDER BY publication";
$result = mysqli_query($conn, $sql);
$tab = mysqli_fetch_all($result, MYSQLI_ASSOC);
mysqli_free_result($result);
mysqli_close($conn);
return $tab;
}
I keep getting this error with all the different conditions I've tried
Thank you in advance!