Guest User

Untitled

a guest
Feb 26th, 2021
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 0.65 KB | None | 0 0
  1. <?php
  2.  
  3. if(array_key_exists('firstname', $_POST) && array_key_exists('lastname', $_POST) && array_key_exists('email', $_POST) ) {
  4.  
  5.     $db = mysqli_connect("localhost","","","") or die ("Connection failed!");
  6.  
  7.     $query = ('INSERT INTO 'Users' (firstname, lastname, email, pass, cpass) VALUES (?, ?, ?, ?, ?)');
  8.     $stmt = $db->prepare($query);
  9.     $stmt->bind_param("sssss", $_POST['firstname'], $_POST['lastname'], $_POST['email'], $_POST['pass'], $_POST['cpass']);
  10.  
  11.   if ($stmt->execute()) {
  12.     'Yay!! New user was added.'
  13.   } else {
  14.     die('Oops we could not add your deatils to the user database.');
  15.   }
  16.  
  17.   $db->close();
  18.  
  19. }
  20.  
  21. ?>
Advertisement
Add Comment
Please, Sign In to add comment