This is a discussion on date query problem, date in variable within the MySQL Database forums, part of the Database Forums category; I am using the following query : $query_archief = "SELECT * FROM vacatures where dd_eind_plaatsing < $dd_eind_plaatsing_archief1" note: $dd_eind_plaatsing_archief1 = 2005-10-...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
I am using the following query :
$query_archief = "SELECT * FROM vacatures where dd_eind_plaatsing < $dd_eind_plaatsing_archief1" note: $dd_eind_plaatsing_archief1 = 2005-10-21 it seems the variable $dd_eind_plaatsing_archief1 is not exepted as a proper date, what is the correct way to set up a query using a date variable. |
|
|||
|
roy wrote:
> I am using the following query : > > $query_archief = "SELECT * FROM vacatures where dd_eind_plaatsing < > $dd_eind_plaatsing_archief1" > > note: $dd_eind_plaatsing_archief1 = 2005-10-21 > > it seems the variable $dd_eind_plaatsing_archief1 is not exepted as a > proper date, what is the correct way to set up a query using a date > variable. Wrinting 2005-10-21 in your script language yields to the number 1974 (2005 minus 10 minus 21). The same is happening in the SQL-query. You must quote the date properly: WHERE dd_eind_plaatsing<'$dd_eind_plaatsing_archief1' Please check for SQL-injection. Greetings Kai -- This signature is left as an exercise for the reader. |