Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Re: Trouble updating value of variable for a placeholder

by peppiv (Curate)
on Jun 18, 2002 at 12:48 UTC ( #175350=note: print w/ replies, xml ) Need Help??


in reply to Re: Trouble updating value of variable for a placeholder
in thread Trouble updating value of variable for a placeholder

UPDATE

Workaround Solution

I found a bug report on the web and a workaround solution. Thought some people might want to know this.

my $sth = $dbh->prepare('SELECT * FROM applicant WHERE date_col = ? OR +DER BY job_position LIMIT ?,10'); $sth->bind_param(2, $limit, DBI::SQL_INTEGER); $sth->execute($date,$limit) or die $sth->errstr;

Sometimes when using placeholders, especially for LIMIT, the DBD gets a little confused on what type of value it's being given. Line 2 binds the string $limit to an integer value. The "2" in the parenthesis is telling it the second string in the 'execute'. If you needed it for the first string it would be sth->bind_param(1, $date, DBI::SQL_INTEGER);
Hey it worked for me. Maybe it can help someone else out.

peppiv


Comment on Re: Re: Trouble updating value of variable for a placeholder
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (7)
As of 2014-12-27 02:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (176 votes), past polls