try this, you may have to config it a little, and you can of course add fields to your form to place more information about the user in the database, but i just stripped this down so you can get the idea, this is a multi user system also
<html>
<head>
<title></title>
<body>
<?
$conn = mysql_connect("localhost", "xxxxxxxxx", "xxxxxxxxxxxx") or die ("Could not connect to database!");
$db = mysql_select_db("xxxxxxxxxxxxxxx") or die ("Could not select database");
if (isset ($create))
{
$queryc = "select * from table where username = '$username';";
$resultc = mysql_query($queryc) or die ("Can not select user database");
$alfonse = false;
while ($rowc = mysql_fetch_array($resultc))
{
if ($uname == $rowc['uname'])
{
$alfonse = true;
}
else
{
}
}
if ($alfonse)
{
echo "<h3>Username already in use.<br>Please select another name.</h3>";
?>
<form name="create" method="POST" action="create.php">
Username <input type="text" name="username"><br>
Password <input type="password" name="password"><br>
<input type="submit" name="create" value="Create Account">
</form>
<?
}
else
{
$query = "insert into table (username, password) values ('$username', password('$password'));";
$result = mysql_query($query) or die ("Could not add to user");
}
}
else
{
?>
<form name="create" method="POST" action="create.php">
Username <input type="text" name="username"><br>
Password <input type="password" name="password"><br>
<input type="submit" name="create" value="Create Account">
</form>
<?
}
?>
</body>
</html>