Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

Answer: What are some common causes of syntax errors in queries?

by btrott (Parson)
on Apr 17, 2000 at 21:03 UTC ( #7833=categorized answer: print w/replies, xml ) Need Help??

Q&A > database programming > What are some common causes of syntax errors in queries? - Answer contributed by btrott

Are you checking for errors? The best way to do this is to set RaiseError to 1:
# do a $dbh = DBI->connect(...) $dbh->{'RaiseError'} = 1;
Then you'll see any errors that your database engine is giving you.

Also, try dumping out the hashref that you're getting back:

use Data::Dumper; while ($pointer = $sth->fetchrow_hashref) { print Dumper $pointer;
That'll show you what fields you're getting in the hash ref that you get back. You might also think about using bind_columns, since it's faster. More details in Tricks with DBI.

Log In?

What's my password?
Create A New User
marioroy Updated Re^3: RFC: Compiling Gtk+ stack on windows with strawberry perl. Also tested Gtk2 installation on Strawberry Perl v5.22.3.1. Installing Tk and Tk::Zinc works fine on Perl v5.22.3.1.
[marioroy]: Hi karlgoethebier. Folks can comment feasibly if asking the review via a meditation (imho).

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (8)
As of 2017-09-24 09:33 GMT
Find Nodes?
    Voting Booth?
    During the recent solar eclipse, I:

    Results (273 votes). Check out past polls.