Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /* This code will make a connection with database */
- $con=mysql_connect("localhost","root","root123");
- /* Now, we select the database */
- mysql_select_db("cus_1");
- /* Now we will store the values submitted by form in variable */
- $username=$_GET['username'];
- $pass=$_GET['email'];
- $phone_number=$_GET['phone_number'];
- /* Now we will check if username is already in use or not */
- $queryuser=mysql_query("SELECT * FROM login WHERE username='$username' ");
- $checkuser=mysql_num_rows($queryuser);
- if($checkuser != 0)
- { echo "Sorry, ".$username." is already been taken."; }
- else {
- /* now we will check if password and confirm password matched */
- if($pass == $confirm_password)
- { echo "Password and confirm password fields were not matched"; }
- else {
- /* Now we will write a query to insert user details into database */
- $insert_user=mysql_query("INSERT INTO cus_book (cus_name, cus_email, cus_key) VALUES ('$username', '$pass', '$phone_number')");
- if($insert_user)
- { echo "VALID"; }
- else
- { echo "error in registration".mysql_error(); }
- /* closing the if else statements */
- }}
- mysql_close($con);
- ?>
Add Comment
Please, Sign In to add comment