Panta Posted November 23, 2009 Share Posted November 23, 2009 // connect to the mysql database server.mysql_connect ($dbhost, $dbusername, $dbuserpass);mysql_select_db($dbname) or die("Cannot select database");//Are they just getting here or submitting their info?if (isset($_POST["username"])) {$username = $_POST["username"];$password = $_POST["password"];$cpassword = $_POST["cpassword"];$email = $_POST["email"];//Was a field left blank?if($username==NULL|$password==NULL|$cpassword==NULL|$email==NULL) {echo "A field was left blank.";}else{//Do the passwords match?if($password!=$cpassword) {echo "Passwords do not match";}else{//Has the username or email been used?$checkuser = mysql_query("SELECT username FROM users WHERE username='$username'");$username_exist = mysql_num_rows($checkuser);$checkemail = mysql_query("SELECT email FROM users WHERE email='$email'");$email_exist = mysql_num_rows($checkemail);if ($email_existɬ|$username_existɬ) {echo "The username or email is already in use";}else{$pin = rand(1000000000,9999999999);//Everything seems good, lets insert.$query = "INSERT INTO users (username, password, email,regno) VALUES('$username','$password','$email','$pin')";mysql_query($query) or die(mysql_error());echo "The user $username has been successfully registered.";echo "Your reg no is" $pin;}}}}?><h1>Register</h1><form action="register.php" method="POST"><table style="border:1px solid #000000;"><tr><td align="right">Username: <input type="text" size="15" maxlength="25" name="username"></td></tr><tr><td align="right">Password: <input type="password" size="15" maxlength="25" name="password"></td></tr><tr><td align="right">Confirm Password: <input type="password" size="15" maxlength="25" name="cpassword"></td></tr><tr><td align="right">Email: <input type="text" size="15" maxlength="25" name="email"></td></tr><tr><td align="center"><input type="submit" value="Register"></td></tr><tr><td align="center"><a href="login.php">Login Here</a></td></tr></table></form></center> This is my script but i don't know where the problem is coming from.i guess the script is having a little erro.Plz help me Link to comment Share on other sites More sharing options...
jlhaslip Posted November 23, 2009 Share Posted November 23, 2009 What sort of problem are you having with the script?Any error messages?Is it doing something wrong? Link to comment Share on other sites More sharing options...
Panta Posted November 23, 2009 Author Share Posted November 23, 2009 What sort of problem are you having with the script?Any error messages?Is it doing something wrong?I have corrected the problem.Thanks Link to comment Share on other sites More sharing options...
norNerd Posted November 23, 2009 Share Posted November 23, 2009 What was your problem? Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.