Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: MySQL Database DBD Error

by roboticus (Chancellor)
on Oct 11, 2012 at 17:50 UTC ( #998498=note: print w/ replies, xml ) Need Help??


in reply to MySQL Database DBD Error

dnamonk:

If you're not using placeholders for your database code, then perhaps you've got a field with an embedded apostrophe in it. For example:

my $t = "Bobby Tables' and HeadName=1; drop table mytable;"; my $SQL = "select * from mytable where id='$t'"; print $SQL, "\n";

If you expand the resulting SQL and reformat it, you'll see that it's rather fortunate that HeadName isn't a column in your table!

select * from mytable where id='Bobby Tables' and HeadName=1; drop table mytable;

...roboticus

When your only tool is a hammer, all problems look like your thumb.


Comment on Re: MySQL Database DBD Error
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://998498]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (3)
As of 2015-07-28 01:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (251 votes), past polls