Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Get Parameter By Form & then insert into tbl

if ( param('Submit') ) { # get data from parameter to database my @params = param(); my $full_name = param ('full_name'); my $pob = param ('pob'); my $dob = param ('dob'); my $gender = param ('gender'); my $address = param ('address'); my $email = param ('email'); my $phone = param ('phone'); my $username = param ('username'); my $password = param ('password'); my $high_school = param ('high_school'); my $school_dep = param ('school_dep'); my $year_in = param ('years'); # data to tbl:students # ---------------------------------------------------------------- my $students = $dsn->prepare("INSERT INTO students (username, password) values (?,?) "); $students->execute($username,$password) or die $DBI::errstr; $students->finish(); # data to tbl:students_bio # ---------------------------------------------------------------- my $students_bio = $dsn->prepare("INSERT INTO students_bio ( username, full_name, pob, dob, gender, addr, email, phone, high_school, school_dep, years ) values (?,?,?,?,?,?,?,?,?,?,?) "); $students_bio->execute($username,$full_name,$pob,$dob, $gender,$address,$email,$phone, $high_school,$school_dep,$year_in) or die $DBI::errstr; $students_bio->finish(); # data to tbl:students_parent # ---------------------------------------------------------------- my $students_parent = $dsn->prepare("INSERT INTO students_parent (username) values (?) "); $students_parent->execute($username) or die $DBI::errstr; $students_parent->finish(); };

I don't have problem to insert data to 1 tables with this method. but when i used this methods to insert data to multiple or more tables, the data just insert into 1st table and no activity with the 2nd $ 3rd table

I'm so sorry if my english so bad. Thank's for the attention, Cheers for u, i'm from indonesia.


In reply to Can't Insert Data To Multiple Table With DBI::Mysql [SOLVED] by pakeidoprek

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2024-04-24 12:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found