Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! C:\xampp\perl\bin\perl.exe
- use DBI;
- use CGI qw(:standard);
- print header;
- # MySQL database configuration
- my $dsn = "DBI:mysql:as5-dylan";
- my $username = "root";
- my $password = '';
- # connect to MySQL database
- my $dbh = DBI->connect($dsn,$username,$password);
- print "Connected to the MySQL database. \n \n";
- # insert data into the car table
- # Formulate Query
- my $sql = "create table EMP(EmpNo varchar(5), EmpName varchar(25), Department varchar(15), Empjob varchar(20), primary key (EmpNo))";
- #Validate the INSERT statement
- my $stmt = $dbh->prepare($sql);
- #Executing the Query
- $stmt->execute();
- #Close the connection
- $dbh->disconnect();
Add Comment
Please, Sign In to add comment