Advertisement
Guest User

Untitled

a guest
May 22nd, 2017
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. <?php
  2. //2. Perform query
  3.  
  4. // Hard coded to test
  5. $first = "John";
  6. $last = "Doe";
  7. $username = "johndoe";
  8. $password = "wordpass";
  9.  
  10. $query = "INSERT INTO table_name (first, last, username, password)
  11. VALUES ('{$first}', '{$last}', '{$username}', '{$password}')";
  12. //Most of the time these come from a form with post method
  13.  
  14. $result = mysqli_query($connection, $query);
  15.  
  16. if($result){
  17. echo "success";
  18. } else {
  19. die("failed");
  20. }
  21. ?>
  22.  
  23. <!DOCTYPE html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement