Here is the page that confirms the record has been added. I have tried your validation script but that doesnt seem to work either. If you could please take a look at the code below and tell me where I am going wrong and how to inform the user that the username has already been taken and thus is not entered into my database. Thanks.
<html>
<head>
<title>Confirmation</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="bootcom.css" rel="stylesheet" type="text/css">
</head>
<body>
<?
$username="bootcom";
$password="mankind";
$database="bootcom_users";
$connection = mysql_connect(localhost,$username,$password)
or die("Database Connection Failed. Please inform our administritive team.");
$result=mysql_select_db($database) or die( "Unable to select database");
function validate_username($username) {
// check length and anything else you want and then check availability
$sql = "SELECT COUNT(id) FROM user_information WHERE username='$username'";
$result = mysql_query($sql);
$row = mysql_fetch_row($result);
if ($row[0] != 0)
return false;
else
return true;
}
$query = "SELECT max(id) as id from user_information";
$result = mysql_query($query);
$id = $row["customerid"] + 1;
$query = "INSERT INTO user_information VALUES ('". $ID ."', '". $firstname ."','". $lastname ."','". $DOB ."','". $email ."','". $city ."','". $telephone ."','". $gender ."','". $username ."','". $password ."','". $MSN ."','". $Yahoo ."','". $date ."')";
$result = mysql_query($query);
if (!$query)
{
die(" Query could not be executed");
}
mysql_close();
print "Record added\n";
?></br>
<p> </p></body>
</html>
😕 😕