glickjd has asked for the wisdom of the Perl Monks concerning the following question:
Can anyone help me out with my perl code?
Here's how my code was written.
#get mileage
my $sth = $dbh->prepare('SELECT number, date, miles, purpose
FROM mileage
WHERE date BETWEEN ? and ?
ORDER BY date ?')
or print "Couldn't prepare statement: " . $dbh->errstr;
$sth->execute($from_date, $to_date, $sort_method) # Execute the query or print "Couldn't execute statement: " . $sth->errstr;
I need to have single quotes around the dates. If I try "BETWEEN '?' and '?'" it doesn't work. I tried putting a backslash before the quotes, but that didn't work either. Does anyone know how to do this?
Thanks
Jeremy
edited: Mon Sep 23 00:31:59 2002 by jeffa - (title change was: This one is perl related)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: This one is perl related
by Zaxo (Archbishop) on Sep 22, 2002 at 21:31 UTC | |
by glickjd (Novice) on Sep 22, 2002 at 21:49 UTC | |
|
Re: This one is perl related
by valdez (Monsignor) on Sep 22, 2002 at 21:54 UTC | |
by Aristotle (Chancellor) on Sep 23, 2002 at 07:22 UTC | |
by valdez (Monsignor) on Sep 23, 2002 at 08:04 UTC | |
by Aristotle (Chancellor) on Sep 23, 2002 at 08:31 UTC | |
|
Re: Quoted dates in SQL with placeholders
by diotalevi (Canon) on Sep 23, 2002 at 13:37 UTC |