CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Advanced:
DB Function Problem.


New User

Feb 28, 2002, 6:40 AM

Post #1 of 3 (3626 views)
DB Function Problem. Can't Post

Hey all.

Can anyone tell me if they see anything wrong with this piece of code?

sub mark_paid{
my @pay_pals=split '', $FORM{ids};
foreach (@pay_pals){
$sql="update commissions set paid=1 where email='$_'";

This is supposed to set the paid field to 1 in a mysql database if a checkbox is checked on a form. However, it is not updating the database for some reason. I cant figure it out.


Feb 28, 2002, 7:05 AM

Post #2 of 3 (3625 views)
Re: [version2] DB Function Problem. [In reply to] Can't Post

Use DBI->err and DBI->errstr to make sure it isn't a syntax error or something. Also print your query to make sure it looks right.

(This post was edited by RedRum on Feb 28, 2002, 7:08 AM)


Mar 1, 2002, 8:18 PM

Post #3 of 3 (3610 views)
Re: [version2] DB Function Problem. [In reply to] Can't Post

Few things:
1) you're splitting on an empty string right ? That way you'll get all the letters in that array, not a good thing
2) you're not quoting your form data so your script is insecure.
3) log your code and you'll see you'll be able to solve problems yourself much often than now


Best regards,

Miroslav Madzarevic, Senior Perl Programmer
Mod Perl Development  -
Telephone: +381 64 1193 501
ICQ: 15880893


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives