mysql - Why isn't my PHP Sign-Up not working?
I have a question about my PHP Login Script. I am very, very new to PHP and MySQL, so keep that in mind when looking at my code.
<?php include('connectdb.php') //define $myusername=$_POST['myusername']; $mypassword=$_POST['mypassword']; $passwordconfirm=$_POST['passwordconfirm']; $email=$_POST['email']; $firstname=$_POST['firstname']; //prevents from MySQL Injection $myusername = stripslashes($myusername); $mypassword = stripslashes($mypassword); $passwordconfirm = stripslashes($passwordconfirm); $email = stripslashes($email); $firstname = stripslashes($firstname); $myusername = mysql_real_escape_string($myusername); $mypassword = mysql_real_escape_string($mypassword); $passwordconfirm = mysql_real_escape_string($passwordconfirm); $email = mysql_real_escape_string($email); $firstname = mysql_real_escape_string($firstname); //Inserting In to Table $sql = "INSERT INTO login3 (username, password, confirmpass, email, firstname) VALUES ($myusername, $mypassword, $passwordconfirm, $email, $firstname)"; ?>
Shouldn't this be inserting all of the values into the table login3?
You have not used a quotation mark for strings while inserting. Also you should use backticks. You should also use mysqli_* instead of mysql_* functions as they are deprecated. Also, there is no reason to store the confirmed password as @AndyIbanez has said, thus alter your table structure. You have not even queried the sql statement. Try this :-
Use this query