Your skill will accomplish what the force of many cannot |
|
PerlMonks |
Re: Re: Re: allowedby arturo (Vicar) |
on Apr 05, 2001 at 03:09 UTC ( [id://69933]=note: print w/replies, xml ) | Need Help?? |
I see nothing wrong with your SQL as written, though I will say this again: Use placeholders. They will prevent certain nasty kinds of errors from cropping up; one thing that might cause problems with your code as written is that IF there any quotes or other zany things in your data, that will result in the SQL string not being well-formed; if you use placeholders, these issues will be dealt with automatically. All this adds up to : use placeholders OK, with that out of the way ... check to see whether you've issued a commit to the database (this will have no effect if you're using a DB without commit and rollback, like vanilla MySQL), as sutch recommended. If the statements execute without error but nothing happens in the database, that's one place to look. Also, as thabenskta mentioned, you should always return the value of $dbh->errstr when a call to the database fails. So put those in, they'll help with debugging! Now, as to the method: whatdo is good for one-off things, but it forces you to prepare each statement each time through the loop. That's inefficient: prepare once, execute many times! So go with the normal prepare, bind, execute cycle:
HTH. Philosophy can be made out of anything. Or less -- Jerry A. Fodor
In Section
Seekers of Perl Wisdom
|
|