daily pastebin goal
68%
SHARE
TWEET

Untitled

a guest Mar 17th, 2018 86 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #! C:\xampp\perl\bin\perl.exe
  2. use DBI;
  3. use CGI qw(:standard);
  4.  
  5. print header;
  6.  
  7. # MySQL database configuration
  8. my $dsn = "DBI:mysql:as5-dylan";
  9. my $username = "root";
  10. my $password = '';
  11.  
  12. # connect to MySQL database
  13. my $dbh  = DBI->connect($dsn,$username,$password);
  14.  
  15. print  "Connected to the MySQL database. \n \n";
  16.  
  17. # insert data into the car table
  18.  
  19. # Formulate Query
  20. my $sql = "INSERT INTO emp(empno, empname) VALUES('1', 'test')";
  21.  
  22. #Validate the INSERT statement
  23. my $stmt = $dbh->prepare($sql);
  24.  
  25. #Executing the Query
  26. $stmt->execute();
  27.  
  28. #Close the connection
  29. $dbh->disconnect();
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top