I am creating a login script and I need to check that the username and e-mail don't current exist in the database otherwise it will print an error. I've tried the following but it's not working:
//Create Username Array
$SQL = "SELECT Username from user"
$Result = mysql_query($SQL);
$Array = mysql_fetch_array($Result);
//Check Username
if ($Username = $Array) {$errormessage = "Sorry, the username $Username is already in use.";}
else {
//Check Password
if ($Password != $RePassword) {$errormessage = "$FName likes it in the butthole, hence why their password doesn't match. Don't worry; however, we've disptached our butt elves to $Addr_Street $Addr_City, $Addr_State $Addr_Zip to remedy the problem";}
else {
Note: I've redacted the Insert statements that follow this ELSE statement
Any tips on what I should be doing instead? Also, is the nested IF statement the best way to go about doing this?