Guest User

Untitled

a guest
Oct 1st, 2018
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.92 KB | None | 0 0
  1. <?php
  2.     $con = mysql_connect("localhost", "root", "H@lp2012") or die(mysql_error());
  3.     $db = mysql_select_db("registerdb", $con) or die(mysql_error());
  4.     $query = mysql_query("SELECT * FROM `users`") or   die(mysql_error());
  5.         $query2 = mysql_query("SELECT * FROM users WHERE username = ".$user_name);
  6.        
  7.         $user_name = $_POST['userName'];
  8.     $user_fname = $_POST['userFName'];
  9.     $user_email = $_POST['userEmail'];
  10.     $user_pass = $_POST['userPassword'];
  11.  
  12.     if(!empty($user_name) && !empty($user_fname) && !empty($user_email) && !empty($user_pass) && mysql_num_rows($query2) == 0) {
  13.  
  14.         mysql_query("INSERT INTO `users` (`fullname`, `username`,`email` ,`password`)
  15.        VALUES ('".$user_fname."', '".$user_name."','".$user_email."','".$user_pass."')") or die (mysql_error());
  16.         echo "You have succefully registered now!";
  17.     }
  18.     else
  19.     {
  20.     echo "Please fill out all the fields!";
  21.     }
  22. ?>
Add Comment
Please, Sign In to add comment