Advertisement
Guest User

Untitled

a guest
Aug 26th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. <?php
  2. $servername = "localhost";
  3. $username = "root";
  4. $password = "password";
  5. $conn = new PDO("mysql:host=$servername;dbname=Akalpa", $username, $password); // connection to my sql database
  6.  
  7. if(isset($_POST['Log In'])){
  8. $username=$_POST['username'];
  9. $query = "Insert into User(username) values('$username')"; //query to insert to db
  10.  
  11. if (mysql_query($query)) //checking the query
  12. {
  13. echo"<h3>Inserted Successfully</h3>"; //value inserted to db successfully
  14. }
  15.  
  16.  
  17. }
  18. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement