Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I was just looking for some assistance with a script. I've only just begun scripting with Perl due to my roommate converting me, so please don't flame.
use DBI; #Welcoming Phrase print "\n\n Welcome to the world.\n\n"; #Load username database print " Are you a new user? (y/n)\n\n"; my $choice=<STDIN>; chomp $choice; if ($choice eq "n") { print " What is your username?\n\n"; my $username = <STDIN> ; chomp $username; my $connect = DBI->connect( "dbi:mysql:database=Champ;host=localhost", 'root','pass'); print "User $username Active\n"; } if ($choice eq "y") { print " What would you like your username to be?\n\n"; my $newuser = <STDIN>; chomp $newuser; my $connect = DBI->connect( "dbi:mysql:database=Champ;host=localhost", 'root','pass'); my $sql = "INSERT INTO test (A,B,C,D) VALUES (?,?,?,?)"; $statement = $connect->prepare($sql); $statement = execute(4,4,4,4); print "User $newuser Active\n"; }
Everything works fine, except the table doesn't get created. Therefore the values aren't created. Again I'm not that experienced so you may need to explain advanced symbols, etc. Any help on why it doesn't work/what to fix is greatly appreciated.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: MySQL Table adding with Perl
by Anonymous Monk on Mar 06, 2013 at 20:28 UTC | |
by Anonymous Monk on Mar 06, 2013 at 20:29 UTC | |
by Anonymous Monk on Mar 06, 2013 at 20:51 UTC | |
by Corion (Patriarch) on Mar 06, 2013 at 21:03 UTC | |
by Anonymous Monk on Mar 06, 2013 at 21:17 UTC | |
| |
|
Re: MySQL Table adding with Perl
by punch_card_don (Curate) on Mar 07, 2013 at 03:15 UTC | |
|
Re: MySQL Table adding with Perl
by Anonymous Monk on Mar 07, 2013 at 09:39 UTC | |
by Anonymous Monk on Mar 07, 2013 at 13:48 UTC | |
by marto (Cardinal) on Mar 07, 2013 at 14:01 UTC | |
by Anonymous Monk on Mar 07, 2013 at 14:34 UTC |