Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function insert()
- {
- $servername = "127.0.0.1";
- $username = "root";
- $password = "(my password here)";
- $dbname = "(my db name here)";
- try
- {
- // preparing database handle $dbh
- $dbh = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password);
- // set the PDO error mode to exception
- $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
- }
- catch(PDOException $e)
- {
- echo ("Could not connect to server.n");
- echo ("getMessage(): " . $e->getMessage () . "n");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement