shortysbest Posted July 7, 2010 Share Posted July 7, 2010 I am building a script for a user to create an account on a site i am working on however It will not post the data to the database, If i echo the data out it is all there and everything, just it will not update on the database, and it doesn't return an error, it says "you have been registered" but the mysql_query is going by.. I cannot figure out why.. it is exactly how i have always done them >.< <?php include('connect.php'); //login start $signup = $_POST['signup']; //form data $fname = ucfirst(strip_tags($_POST['fname'])); $lname = ucfirst(strip_tags($_POST['lname'])); $email = strtolower(strip_tags($_POST['email'])); $password = strtolower(strip_tags($_POST['password'])); $gender = $_POST['gender']; $fbirthday = $_POST['birthday1'].'/'.$_POST['birthday2'].'/'.$_POST['birthday3']; $birthday = $fbirthday; if ($signup) { //check for existance if ($fname&&$lname&&$password&&$email&&$gender&&$birthday) { //register user! //encrypt password $password = md5($password); $queryreg = mysql_query("INSERT INTO users VALUES('','$fname','$lname','$email','$gender','$birthday','')"); print "<h3>You have been registered.</h3>"; } else echo "<h2>Please fill in all fields.</h2>"; } ?> Link to comment https://forums.phpfreaks.com/topic/207053-user-signup-with-site-error/ Share on other sites More sharing options...
shortysbest Posted July 7, 2010 Author Share Posted July 7, 2010 Nevermind.. Forgot to put $password in the query >.< Link to comment https://forums.phpfreaks.com/topic/207053-user-signup-with-site-error/#findComment-1082680 Share on other sites More sharing options...
ChemicalBliss Posted July 7, 2010 Share Posted July 7, 2010 Since you've fixed it ill give u a quick tip: always echo the full query before executing it, will prevent you from mucking up your database. (Trial your script before you make it live). $query = "INSERT INTO users VALUES('','$fname','$lname','$email','$gender','$birthday','')"; exit("<br />QUERY: ".$query."<br />"); $queryreg = mysql_query($query) or die(mysql_error()); or die(mysql_error()); can be very useful especially if display errors is off. -cb- Link to comment https://forums.phpfreaks.com/topic/207053-user-signup-with-site-error/#findComment-1082683 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.