Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <form id="myForm" action="insert.php" method="post">
- Name: <input type="text" name="name"/><br/>
- Username: <input type="text" name="username"/><br/>
- Password: <input type="password" name="password"/><br/>
- <button id="sub">Save</button>
- </form>
- <span id="result"></span>
- include_once('db.php');
- $name = $_POST['name'];
- $username = $_POST['username'];
- $password = $_POST['password'];
- if(mysql_query("INSERT INTO table_users VALUES('$name', '$username', '$password')")){
- echo "Successfully Inserted";
- } else {
- echo "Insertion Failed";
- }
- $conn = mysql_connect('localhost', 'root', '');
- $db = mysql_select_db('neverstoplearning');
- <?php
- $con = mysqli_connect("localhost","my_user","my_password","my_db");
- // Check connection
- if (mysqli_connect_errno())
- {
- echo "Failed to connect to MySQL: " . mysqli_connect_error();
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement