|
Posted by james.gauth on 06/25/07 11:24
On 25 Jun, 11:39, Andre Stumpf <andre.stu...@stumpfi.com> wrote:
> Hi,
>
> i want to compare dates. The dates are like "2007-06-25".
> I tried this:
> $SQLString = "SELECT * FROM myDB.myTABLE WHERE dat_start = $act_dat";
> But it didn't work.
> What can I do?
> Thank you!
>
> André
This problem is more than likely due to your dates not being inside
quotes in the SQL query. When substitution takes place, your SQL
string should end up similar to this:
SELECT * FROM myDB.myTABLE WHERE dat_start = '2007-06-25'
Whereas without quotes the query would fail because of the unquoted
literal:
SELECT * FROM myDB.myTABLE WHERE dat_start = 2007-06-25
If the dates are coming from user input, be careful not to allow a SQL
injection exploit
Navigation:
[Reply to this message]
|