I am using mysql and php to pull all the users out of the mysql database that are equal to todays date. The problem I am having is whenever I run the following code I get an error. By the look of the error is seems to be something to do with the year, or maybe it doesn’t like the dots in it, but im not sure ?.
<?php
$today = date("d.m.y");
$result = mysql_query("SELECT * FROM ymeg_chronoforms_data_NewsletterSubscribe
WHERE date=$today")or die(mysql_error());
while($row = mysql_fetch_array($result))
{
echo $row['name'] . " " . $row['email']. " " . $row['date'];
echo "<br />";
}
?>
This is the error it is throwing :
You have an error in your SQL syntax; check the manual that corresponds to your
MySQL server version for the right syntax to use near '.12' at line 2
You have to add quotes around your date string: