Advertisement
Guest User

Untitled

a guest
Jun 22nd, 2017
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.59 KB | None | 0 0
  1. <?php
  2.  
  3.     $username = $_POST['username'];
  4.     $password = $_POST['password'];
  5.     $email = $_POST['email'];
  6.    
  7. @ $db = new mysqli('localhost','testdb','bob123456','testdb_');
  8.  
  9. if (mysqli_connect_errno()) {
  10.     echo 'Error: Could not connect to the database. Please try again later.';
  11.     exit;
  12. }
  13.  
  14. $query = "INSERT INTO users VALUES ('".$username."','".$password."','".$email."')";
  15.  
  16. $result = $db->query($query);
  17.  
  18. if($result) {
  19.     echo $db->affected_rows." users entered ";
  20. } else {
  21.     echo "An error occurred<br />";
  22. }
  23.  
  24. $db->close();
  25.  
  26. echo $username . " : " . $password . " : " . " : " . $email;
  27.  
  28. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement