Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $existance = mysql_query("SELECT username FROM users WHERE username = '" . $username . "'");
- if( !$existance ){
- $query = "INSERT into `users` (username, password, email, trn_date) VALUES ('$username', '".md5($password)."', '$email', '$trn_date')";
- $result = mysql_query( $query );
- if ( $result ) {
- echo "<div class='form'><h3>You are registered successfully.</h3><br/>Click here to <a href='login.php'>Login</a></div>";
- }
- else{
- //unsuccessful insertion
- }
- } else {
- //the user existed already, choose another username
- }
- ?>
- if ($num_rows > 1) { $error = 1; } else { $error = 0; }
- if ($error == 0) { $query = "INSERT into `users` (username, password, email, trn_date) VALUES ('$username', '".md5($password)."', '$email', '$trn_date')";
- $result = mysql_query($query);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement