Why is this SQL not working

Gang67

|Jump out gang, we jump out those vehicles|
May 5, 2017
303
54
It isn't sending the data to my database nor showing error messages

Code:
<?php
session_start();
//connect to database
$db=mysqli_connect("localhost","root","{DB PASSWORD}","rppp");
if(isset($_POST['register_btn']))
{
    $username=mysql_real_escape_string($_POST['username']);
    $email=mysql_real_escape_string($_POST['email']);
    $password=mysql_real_escape_string($_POST['password']);
    $password2=mysql_real_escape_string($_POST['password2']);
     if($password==$password2)
     {           //Create User
            $password=md5($password); //hash password before storing for security purposes
            $sql="INSERT INTO users(username,email,password) VALUES('$username','$email','$password')";
            mysqli_query($db,$sql);
            $_SESSION['message']="You are now logged in";
            $_SESSION['username']=$username;
            header("location:home.php");  //redirect home page
    }
    else
    {
      $_SESSION['errormessage']="The two password do not match";  
     }
}
?>

Code:
<div class="content">
<form method="post">
    <input type="text" name="username" id="username" class="form" placeholder="Username"> <br /><br />
        <input type="text" name="email" id="email" class="form" placeholder="Email"> <br /><br />
            <input type="password" name="password" id="password" class="form" placeholder="Password"> <br /><br />
        <input type="password" name="password2" id="password2" class="form" placeholder="Verify Password"> <br /><br />
            <input type="submit" name="register_btn" id="register_btn" class="submit">
         </form>
 

Mikee

Active Member
Jul 8, 2017
162
102
Trying to make my own
I don't have any help to give you only a comment of well done. I must say that I am impressed. You've gone from a noob asking simple questions (which we all have asked from time to time) to pushing yourself to teach yourself to code and make your own cms, in what I think is a relatively short amount of time. Well done, I have a high level of respect for you. Keep going, never give up, and I'm excited to see your work in the future.
 

Gang67

|Jump out gang, we jump out those vehicles|
May 5, 2017
303
54
I don't have any help to give you only a comment of well done. I must say that I am impressed. You've gone from a noob asking simple questions (which we all have asked from time to time) to pushing yourself to teach yourself to code and make your own cms, in what I think is a relatively short amount of time. Well done, I have a high level of respect for you. Keep going, never give up, and I'm excited to see your work in the future.
Thank you :)
 

Users who are viewing this thread

Top