rondog Posted September 27, 2007 Share Posted September 27, 2007 Im sure its something small that I am just overlooking, but when I hit submit it just refreshes and nothing is getting inserted nor am I getting and error via mysql_error(); <?php include 'connect.php'; $fname = $_POST['fname']; $lname = $_POST['lname']; $email = $_POST['email']; $pword = md5($_POST['pword']); $submit = $_POST['submit']; if($submit != "") { $emailcheck = mysql_query("SELECT * FROM users WHERE email = '$email';") or die(mysql_error()); $totalemails = mysql_num_rows($emailcheck); if($totalemails > 0) { echo "please fix the following errors: <br>"; if($totalemails > 0) { echo "That email is already registered to a user."; } exit(); } $insert = mysql_query("INSERT INTO users (firstname, lastname, email, password) VALUES ('$fname', '$lname', '$email', '$pword');") or die(mysql_error()); if($insert) { echo "User ($fname) inserted into DB."; } else { echo "There was an error inputing the user into the DB."; } } ?> Quote Link to comment https://forums.phpfreaks.com/topic/70969-solved-not-inserting-nor-mysql_error/ Share on other sites More sharing options...
MadTechie Posted September 27, 2007 Share Posted September 27, 2007 for testing change $submit = $_POST['submit']; if($submit != "") { to $submit = $_POST['submit']; var_dump($submit); //debug if($submit != "") { Quote Link to comment https://forums.phpfreaks.com/topic/70969-solved-not-inserting-nor-mysql_error/#findComment-356804 Share on other sites More sharing options...
rondog Posted September 27, 2007 Author Share Posted September 27, 2007 gah..ok well that helped me solve it. It was NULL after submit, so I check the form and its name was "Submit" not "submit" hehe thanks..that var_dump function will come in handy! Quote Link to comment https://forums.phpfreaks.com/topic/70969-solved-not-inserting-nor-mysql_error/#findComment-356805 Share on other sites More sharing options...
MadTechie Posted September 27, 2007 Share Posted September 27, 2007 yep, var_dump() and print_r(), are very usful Quote Link to comment https://forums.phpfreaks.com/topic/70969-solved-not-inserting-nor-mysql_error/#findComment-356809 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.