Advertisement
Guest User

Untitled

a guest
Feb 29th, 2016
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. <form id="myForm" action="insert.php" method="post">
  2.  
  3. Name: <input type="text" name="name"/><br/>
  4.  
  5. Username: <input type="text" name="username"/><br/>
  6.  
  7. Password: <input type="password" name="password"/><br/>
  8.  
  9. <button id="sub">Save</button>
  10. </form>
  11.  
  12. <span id="result"></span>
  13.  
  14. include_once('db.php');
  15.  
  16. $name = $_POST['name'];
  17. $username = $_POST['username'];
  18. $password = $_POST['password'];
  19.  
  20. if(mysql_query("INSERT INTO table_users VALUES('$name', '$username', '$password')")){
  21. echo "Successfully Inserted";
  22. } else {
  23. echo "Insertion Failed";
  24. }
  25.  
  26. $conn = mysql_connect('localhost', 'root', '');
  27. $db = mysql_select_db('neverstoplearning');
  28.  
  29. <?php
  30. $con = mysqli_connect("localhost","my_user","my_password","my_db");
  31.  
  32. // Check connection
  33. if (mysqli_connect_errno())
  34. {
  35. echo "Failed to connect to MySQL: " . mysqli_connect_error();
  36. }
  37. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement