The extra one is supposed to be there (or at least I thought so!). I need it to update the database with a new member. Basically, I had this script working fine using:
<?php
include("common.php");
if(!($link_id = mysql_connect($Host, $User, $Pass)))
{
die(mysql_error());
}
mysql_select_db($DB);
$sql = "INSERT INTO " . $Table . " VALUES('','" . $_POST['username'] . "','" . md5($_POST['password']) . "','" . $_POST['firstname'] . "','" . $_POST['lastname'] . "','" . $_POST['email'] . "','" . $_POST['address1'] . "','" . $_POST['address2'] . "','" . $_POST['county'] . "','" . $_POST['postcode'] . "','" . $_POST['country'] . "')";
if(!($result = mysql_query($sql)))
{
die(mysql_error());
}
else
{
header('refresh: 5; url=index.php');
echo "<b><u><center>Your account has been created! </b></u><br>Sit tight, we're sending you back to the login page in 5 seconds.<br>
If your browser doesn't support redirection and you're still here in 5 seconds, <a href='index.php'>click here</a></center>";
}
?>
This worked fine with ID as the primary key and username as a unique field. I just wanted to make the notification that a user with the same username already existed on the database and to prompt the user to select another username rather than the standard : "Duplicate entry 'xxxxx' for key 2"
The way I read the code I have written in my previous posts is basically, if the result of the userexists query returns 1 match, display the message "Username exists" else run the $sql query and update the database with the new member. Have I missed a big chunk out here?