Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

RE: RE: RE: DBI Select and Update

by nutate (Novice)
on May 31, 2000 at 19:25 UTC ( [id://15628]=note: print w/replies, xml ) Need Help??


in reply to RE: RE: DBI Select and Update
in thread DBI Select and Update

Now that's a good call. Good syntax as well. Thanks a ton. It defeats the purpose of the placeholders to call them every loop

My problem was my inability to realize i could make more than one statement handle, that makes everything easier, even though the man pages no doubt explicitly state that you can. Go go perlmonks.

Ok, now thanks for all the help, here is the finished product:

Note that i stayed with the bind_columns/fetch idea, which should be faster. I suppose, though, that a bind_col might speed it up even more...

$sth = $dbh->prepare(q{SELECT oid from items where orderid = ?}) || +die $dbh->errstr; $sth->execute($orderid) || die $dbh->errstr; $sth->bind_columns(\$oid); # Binds each column to $oid, through ref +erence my $sth_udt = $dbh->prepare(qq{UPDATE items set price = ? WHERE oid += ?}); while ($sth->fetch) { my $price = param("item_${oid}_price"); $sth_udt->execute($price, $oid); # You could probably just do this, but it didn't work for me...? +!?!: # $sth_udt->execute(param("item_${oid}_price"), $oid); }

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (9)
As of 2024-04-23 07:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found