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
https://forums.phpfreaks.com/topic/70969-solved-not-inserting-nor-mysql_error/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.