我正在使用 mysql 和 php 将所有与今天日期相同的用户从 mysql 数据库中提取出来。我遇到的问题是每当我运行以下代码时都会出错。看起来错误似乎与年份有关,或者它不喜欢其中的点,但我不确定?
<?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 />";
}
?>
这是它抛出的错误:
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