Advertisement
mdmuktarali

Database Connection with Data Send into Database

Sep 30th, 2017
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. <?php
  2. $dbhost = 'localhost';
  3. $dbuser = 'root';
  4. $dbpass = '';
  5. $db = 'muktar';
  6. $con = mysqli_connect($dbhost, $dbuser, $dbpass, $db);
  7. if(!$con){
  8. echo "DB Connection Error";
  9.  
  10. }
  11. if(!empty($_POST)){
  12. $name = $_POST['name'];
  13. $phone = $_POST['cell'];
  14. $email = $_POST['email'];
  15. $username = $_POST['username'];
  16. $password = $_POST['password'];
  17. $repassword = $_POST['repass'];
  18.  
  19. $insert = "INSERT INTO register_user(id,name,phone,email,username,password)
  20. VALUES('', '$name', '$phone', '$email', '$username', '$password')";
  21.  
  22. if(mysqli_query($con, $insert)){
  23. echo "Registration Successfully";
  24.  
  25. }
  26. else{
  27. echo "Registration Failed";
  28. }
  29. }
  30. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement