$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
In reply to Oddly named Mysql table and backticks by neilwatson
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |