Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //connecting to database Server
- $connection = mysql_connect('localhost', 'root', '');
- if (!$connection){
- die("Database Connection Failed" . mysql_error());
- }
- echo "connected successfully";
- //seleting database
- $select_db = mysql_select_db('Watches');
- if (!$select_db){
- die("Database Selection Failed" . mysql_error());
- }
- //Inserting values in table myaccount
- if(isset($_POST['firstname']) && isset($_POST['email']) && isset($_POST['username']) && isset($_POST['password'])){
- $fname = $_POST['firstname'];
- $lname = $_POST['lastname'];
- $email = $_POST['email'];
- $username = $_POST['username'];
- $password = $_POST['password'];
- $cpassword = $_POST['confirmpassword'];
- $query = 'INSERT INTO myaccount
- (firstname, lastname, email,username,password,confirmpassword)
- VALUES ('$fname', '$lname', '$email' ,'$username', '$password', '$cpassword')';
- $result = mysql_query($query);
- if($result){
- $msg = "User Created Successfully.";
- echo $msg;
- }
- mysql_close($connection);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement