Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Problem with INSERT statement

by imp (Priest)
on Dec 19, 2006 at 21:23 UTC ( #590790=note: print w/ replies, xml ) Need Help??


in reply to Problem with INSERT statement

You initialize $dbh using the first argument to the function, but you then overwrite that variable with a new connection for every loop iteration.

Do one of these:

  1. Pass the handle in, do not disconnect in the subroutine
  2. Connect at the top of the subroutine, disconnect at the bottom of the subroutine
  3. Connect at the top of the loop, disconnect at the bottom of the loop
I would recommend #1 or #2, as #3 is only appropriate if you are connecting to dynamic sources. Very inefficient otherwise.


Comment on Re: Problem with INSERT statement
Re^2: Problem with INSERT statement
by sasrs99 (Acolyte) on Dec 19, 2006 at 21:46 UTC
    #2 worked like a charm. Thanks!

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (12)
As of 2014-07-30 16:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (235 votes), past polls