Jump to content

[SOLVED] Not INSERTing nor mysql_error


rondog

Recommended Posts

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.