I have a PHP query that I only want to select if the date is 2014 in the table:
$result=mysqli_query($linkID, "SELECT * FROM table WHERE date(Y) = '2014'";
I'm trying to call "date(Y)" with the correct expression as that is obviously incorrect.
I have a PHP query that I only want to select if the date is 2014 in the table:
$result=mysqli_query($linkID, "SELECT * FROM table WHERE date(Y) = '2014'";
I'm trying to call "date(Y)" with the correct expression as that is obviously incorrect.
Use this:
$result=mysqli_query($linkID, "SELECT * FROM table WHERE YEAR(datetime_field) = 2014");