note 53837 added to ref.datetime
| From: | vicente dot mollon at kleinundgross dot net | Date: | Tue, 14 Jun 2005 19:10:10 +0000 |
| Subject: | note 53837 added to ref.datetime | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-90430@lists.php.net to get a copy of this message | ||
I'm trying to get only the records of today date from a database, when I test my application
the browser returns me a SQL error:
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 '()' at line 1
And my scripts is:
<?php
mysql_select_db($database_noticias, $noticias);
$query_noticias = "SELECT * FROM noticias WHERE fecha = Date()";
$noticias = mysql_query($query_noticias, $noticias) or die(mysql_error());
$row_noticias = mysql_fetch_assoc($noticias);
$totalRows_noticias = mysql_num_rows($noticias);
?>
If I delete the part: ... FROM noticias WHERE fecha = Date()
the problem is over but obiously shows me all the records that I have in my table (a lot, about 3
years of 5 daily news).
So, I need help, I only want to show the records that equals to TODAY's DATE
Can anyone help me?
----
Manual Page -- http://www.php.net/manual/en/ref.datetime.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+53837
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+53837&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+53837&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+53837&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+53837&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+53837&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+53837&report=yes
Search -- http://master.php.net/manage/user-notes.php