Hi guys, When I try to run the following script (and yes, the connection works): $hourago = time()-3600;$tokendel = $dbh->exec("DELETE * FROM tokens WHERE setdate < '$hourago'"); PHP: It gives me this error: Uncaught exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '* FROM tokens WHERE setdate \< '1358193601'' at line 1' in /home/content/42/9125042/html/resources/tokenclear.php:10 Why doesn't my script work? Thanks, -Tony
Your script is escaping the less than symbol. < = \< I would try something like: $statement = $dbh->prepare('DELETE * FROM tokens WHERE setdate < :hourago'); $statement->execute(array(':hourago' => $hourago));
I tried it, but got the same result: Uncaught exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '* FROM tokens WHERE setdate < '1358209803'' at line 1' in /home/content/42/9125042/html/resources/tokenclear.php:11 -Tony
I'll take out the *, but I don't think it will do anything. The problem seems to be the < sign being turned into <. How can I stop that from happening? Thanks, -Tony