Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Extra iteration while fetching 'fetchrow_array' in DBI and standerd way of using DBI

by jZed (Prior)
on Jun 15, 2007 at 17:18 UTC ( [id://621485]=note: print w/replies, xml ) Need Help??


in reply to Extra iteration while fetching 'fetchrow_array' in DBI and standerd way of using DBI

I'm afraid your code is too long for me to be able to answer your main questions, but here are some general suggestions:
  • instead of sprinkling DBI::errstrs all over your code, just set RaiseError=>1,PrintError=>0 in you connection which will automatically do the the error checking and reporting.
  • Instead of $sth->fetchrow_array, use $sth->fetchrow_hashref or bind_columns() to put your results in a hash since you want a hash, not an array
  • Do not pass your user input directly into the SQL the way you are doing now, read about placeholders, and always use them.
  • Comment on Re: Extra iteration while fetching 'fetchrow_array' in DBI and standerd way of using DBI

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (3)
As of 2024-04-19 22:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found