Advertisement
Guest User

Untitled

a guest
May 26th, 2016
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.72 KB | None | 0 0
  1. <?php
  2. $host = 'localhost';
  3. $user = 'root';
  4. $pass = '';
  5. $db   = 'mcgas';
  6. $charset = 'utf8';
  7.  
  8.  
  9. //pdo connection
  10. //odb object database
  11.  
  12. $odb = new PDO("mysql:host=" . $host . ";dbname" . $db, $user, $pass);
  13. // set the PDO error mode to exception
  14. $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  15.    
  16.    
  17.  if (isset($_POST['username'])) {
  18.     $username = $_POST['username'];
  19.     $password = $_POST['password'];
  20.     $email = $_POST['email'];
  21.    
  22.     $q = "INSERT INTO users(user_name, user_passwod, user_email) VALUES(':username', ':password', ':email');";
  23.    
  24.     $query = $odb->prepare($q);
  25.     $results = $query->execute(array(
  26.         ":username" => $username,
  27.         ":password" => $password,
  28.         ":email" => $email
  29. ));
  30. }
  31.  
  32. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement