$query = mysql_query("SELECT * FROM `users`") or die(mysql_error());
while( $row = mysql_fetch_array($query))
{
$loginName = $row['loginName'];
$email = $row['email'];
if ("Kelz" == $loginName || "
[email protected]" == $email)
/*
You can add: md5('hello') == $password || $createDate = "11.12.07" but think about it,
if 2 users have registered on the same date and with the same password,
you don't want it to block 1 of em because he chose the same password or registered on the same date the other one did.
if you still want it to be like this, also add $password = $row['password']; and $createDate = $row['createDate'];
*/
echo "loginName::Kelz already exists OR email::
[email protected] is already in use.";
/* **** OR : ****
// (same thing, just look it it)
if("Kelz" == $loginName) echo "loginName:: Kelz already exists";
if("
[email protected] == $email) echo "email::
[email protected] is already in use.";
else
{
// Insert values...
mysql_query("INSERT INTO `users` (`loginName`, `createDate`, `password`, `email`) VALUES ('Kelz', '11.12.07', md5('hello'), '
[email protected]'"));
// BTW, your query was wrong -> after md5('hello') you typed ' ' and then ' ' again which is wrong - SQL thinks it's another value.
// Look at the query I typed, this one works.
}
}
If you seem that the code I typed is really long - it's not, I just typed a lot of comments to explain you things, lol.