Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

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

by chromatic (Archbishop)
on Apr 17, 2000 at 21:08 UTC ( #7834=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 chromatic

If you're not using the RaiseError attribute, you can check $sth->err to see if there was an error in the query. (I don't see where you specifically do any quoting of the values stored $username and $password, so that's still a possibility in my mind. btrott has a good tutorial on placeholders here.)

The other thing worth checking is: print keys %$pointer; just to see if having Login capitalized in the $user2 assignment is a problem (as it's all lowercase in the SELECT statement).

According to the Perl DBI book, some database drivers convert field names to all uppercase or all lowercase. You can coerce DBI into fixing this for you with the following modification: $pointer = $sth->fetchrow_hashref('NAME_lc'); That will make the hash keys all lowercase. 'NAME_uc' makes them all uppercase. 'NAME' is the default, doing no mangling at all.

Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
[holli]: i just keep spamming
[holli]: writing a cb client in operl 6
[LanX]: operl?
[LanX]: 😅
[holli]: typo

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2017-09-23 12:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    During the recent solar eclipse, I:









    Results (272 votes). Check out past polls.

    Notices?