Bez popisu

addUser.php 794B

123456789101112131415161718192021222324252627282930313233
  1. <?PHP
  2. //---------------
  3. // Connection to server and database
  4. //---------------
  5. $host = "localhost";
  6. $basedatos = "techos";
  7. $user = "pablo.puig1";
  8. $passw = "9NA3kSExI2fGE6eV";
  9. try{
  10. $connection = mysqli_connect($host, $user, $passw, $basedatos) or $error = 1;
  11. }
  12. catch(Exception $ex){
  13. print("Error connecting to database: ". $ex->getMessage()) and die();
  14. }
  15. ?>
  16. <?PHP
  17. $name = $_POST['username'];
  18. $acc_type = $_POST['ACC'];
  19. $email = $_POST['email'];
  20. $phone_num = $_POST['phone'];
  21. $queryAddUser = "INSERT INTO users (name, acc_type, email, phone_num) VALUES ('$name', '$acc_type', '$email', '$phone_num')";
  22. mysqli_query($connection, $queryAddUser);
  23. // $stmtAdd = mysqli_prepare($connection, $queryAddUser);
  24. // mysqli_stmt_execute($stmtAdd);
  25. header("Location: usersTable.php");
  26. exit();
  27. ?>