neilwatson has asked for the wisdom of the Perl Monks concerning the following question:
$statement = 'SELECT trnemailaddress, activedate FROM `customer-trans` WHERE (UNIX_TIMESTAMP(activedate) + ? ) < (UNIX_TIMESTAMP(NOW());'; $sth = $dbh->prepare($statement) or die "Couldn't prepare statement:". +$dbh->errstr; $sth->execute($grace) or die "Couldn't prepare statement:".$dbh->errst +r; # get and print results while ($ref = $sth->fetchrow_hashref()){ print $ref->{'trnemailaddress'} . "\t\t\t". $ref->{'activedate'}; }
Returns:
DBD::mysql::st execute failed: You have an error in your SQL syntax. +Check the manual that corresponds to your MySQL server version for th +e right syntax to use near '' at line 1 at ./chpasswd line 35. Couldn't prepare statement:You have an error in your SQL syntax. Chec +k the manual that corresponds to your MySQL server version for the ri +g ht syntax to use near '' at line 1 at ./chpasswd line 35.
If I leave the backticks off I get an error that starts at -trans. Any suggestions?
Neil Watson
watson-wilson.ca
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Oddly named Mysql table and backticks
by ercparker (Hermit) on Jun 18, 2005 at 14:44 UTC | |
by neilwatson (Priest) on Jun 18, 2005 at 15:00 UTC | |
by ercparker (Hermit) on Jun 18, 2005 at 15:04 UTC | |
|
Re: Oddly named Mysql table and backticks
by Fletch (Bishop) on Jun 18, 2005 at 15:28 UTC | |
|
Re: Oddly named Mysql table and backticks
by jZed (Prior) on Jun 18, 2005 at 14:18 UTC |