in reply to Re^2: MySQL Table adding with Perl
in thread MySQL Table adding with Perl
Still not working
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 $dbh->do("DROP TABLE IF EXISTS $newuser"); $maketable = ("CREATE TABLE $newuser (A,B,C,D,E)"); my $sql = "INSERT INTO $newuser (A,B,C,D,E) VALUES (?,?,?,?,?)"; $sth = $dbh->prepare($maketable); $sth = execute(); $statement = $connect->prepare($sql); $statement = execute(4,4,4,4,0); print "User $newuser Active\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: MySQL Table adding with Perl
by Corion (Patriarch) on Mar 06, 2013 at 21:03 UTC | |
by Anonymous Monk on Mar 06, 2013 at 21:17 UTC | |
by Corion (Patriarch) on Mar 06, 2013 at 21:22 UTC | |
by Anonymous Monk on Mar 06, 2013 at 21:27 UTC |