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."; } } ?> 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 != "") { 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! 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 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
Archived
This topic is now archived and is closed to further replies.