Guest User

Untitled

a guest
Jan 24th, 2018
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.45 KB | None | 0 0
  1. <?php
  2.  
  3. $hostname = 'localhost';
  4. $username = 'chromana_test';
  5. $password = 'pie';
  6.  
  7. try {
  8.     $dbh = new PDO("mysql:host=$hostname;dbname=chromana_main", $username, $password);
  9.  
  10.     /*** echo a message saying we have connected ***/
  11.     echo 'Connected to database';
  12.     $dbh->exec("INSERT INTO users(UserID, Name) VALUES ('1', '".$_POST["name"]."' )");
  13.     $dbh = null;
  14.     }
  15. catch(PDOException $e)
  16.     {
  17.     echo $e->getMessage();
  18.     }
  19.    
  20. ?>
Add Comment
Please, Sign In to add comment