ohdang888 Posted January 14, 2008 Share Posted January 14, 2008 this code dies not have any errors, and its create blank rows(except for the "id" column), but why isn't it inserting info??? $username = $_POST["username"]; $email = $_POST["email"]; $password = $_POST["password1"]; $sql="INSERT INTO `user` (`username`, `password`, `email`) VALUES ( '$username', '$email', '$password')"; mysql_query($sql) or die ( mysql_error()); } ?> <html> <form name=”reg” method=”post” enctype=”application/x-www-form-urlencoded”> username: <input type=”text” name=”username” /><br /><?php echo $error[’userexists’]; echo $error[’usernameinput’]; ?> email: <input type=”text” name=”email” /><br /> password1: <input type=”password” name=”password1” /><br/> password2: <input type=”password” name=”password2” /><br/> <input type=submit name=”submit” value=”submit” /><br> </form> Quote Link to comment https://forums.phpfreaks.com/topic/85901-insert-not-working/ Share on other sites More sharing options...
Lamez Posted January 14, 2008 Share Posted January 14, 2008 you have your values all mixed up, you need to make sure it looks like the database say your DB looks like username password email then your query needs to look like $sql="INSERT INTO `user` (`username`, `password`, `email`) VALUES ( '$username', '$password', '$email')"; yours looks like $sql="INSERT INTO `user` (`username`, `password`, `email`) VALUES ( '$username', '$email', '$password')"; Quote Link to comment https://forums.phpfreaks.com/topic/85901-insert-not-working/#findComment-438565 Share on other sites More sharing options...
revraz Posted January 14, 2008 Share Posted January 14, 2008 Also, remove this from your FORM enctype="application/x-www-form-urlencoded" Quote Link to comment https://forums.phpfreaks.com/topic/85901-insert-not-working/#findComment-438574 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.