Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Re: MySQL Error

by Caillte (Friar)
on Nov 20, 2001 at 21:29 UTC ( #126555=note: print w/ replies, xml ) Need Help??


in reply to Re: MySQL Error
in thread MySQL Error

This isn't perfect as you do not quote $status. It is often better to let DBI do that for you:

my $arg; if(defined $status) { $statement = 'SELECT COUNT(*) FROM name WHERE status=?;'; $arg = $status; } else { $statement = 'SELECT COUNT(*) FROM name WHERE age=?;'; $arg=4; } $sth = $dbh->prepare($statement) or die "Cannot Prepare $DBI::errstr"; $sth->execute($arg) or die "Cannot execute $DBI::errstr";

Calling the statement this way makes sure the data is properly quoted.

$japh->{'Caillte'} = $me;


Comment on Re: Re: MySQL 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://126555]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (8)
As of 2014-11-27 02:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (178 votes), past polls