Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
This works perfectly as it is but I have need to loop over this three times to get all the form variables without actually hardcoding three mysql statements.$store = qq(INSERT INTO main (creator_name,relationship) VALUES("$ +data{creatorname}","$data{relationship}") );
And it errors with the generic "something is bad with your mysql query. Anyone know what I need to do to get $data{relationship$i} to work in this way?$store = qq(INSERT INTO main (creator_name,relationship,reason, em +ail,name,creator_email,creator_url,victim_url,length_of_stay,release_ +date,ip,state) VALUES("$data{creatorname}","$data{relationship}") ); [/code] What I'm trying to do is [code] for (my $i = 0; $i <=3; $i++) { $store = qq(INSERT INTO main (creator_name,relationship) VALUES("$ +data{creatorname}",$data{"relationship$i"}) );
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: $data{"str$i"} not valid in mysql select?
by MidLifeXis (Monsignor) on Nov 27, 2013 at 14:09 UTC | |
|
Re: $data{"str$i"} not valid in mysql select?
by Anonymous Monk on Nov 27, 2013 at 06:48 UTC | |
|
Re: $data{"str$i"} not valid in mysql select?
by Anonymous Monk on Nov 27, 2013 at 00:44 UTC | |
by taint (Chaplain) on Nov 27, 2013 at 02:26 UTC |