Though using the 'do' method is less code, using 'prepare' gives you the opportunity to add another 'die' command;
my $sth = $dbh->prepare($query) or die "unable to prepare:$DBI::errstr\n";This will show if the error is in the SQL or in the execution
Good to see the ? placeholders in use. Our server failed a penetration test as my boss put the variables straight into the SQL statement! :)
I don't think you need the double quotes around the variables provided to the execute method, wont they take care of themselves?
In reply to Re: DBD::mysql::st execute failed: You have an error in your SQL syntax;
by OpenSpace
in thread DBD::mysql::st execute failed: You have an error in your SQL syntax;
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |