Hello all php:ers out there!
Something is wrong with this code I've written...
It works only for EITHER $usename OR $email... but not both for some reason =(
Maybe u guys can see what's wrong... and maybe come with other suggestions on how I can simplify it perhaps?
elseif($main_control = 1){
$str = $username;
$str = strtolower($str);
require ('mysqlcon.php');
$result = mysql_query("SELECT * FROM reg_info", $starta);
while ($array = mysql_fetch_array($result)) {
if($str == $array["username"]) {
$empty_username = "Ooops! - The nickname you chose allready exists!";
$main_control2 = 1;
break;
mysql_close($starta);
}
}
}
elseif($main_control2 !=1){
require ('mysqlcon.php');
$result = mysql_query("SELECT * from reg_info", $starta);
while ($array = mysql_fetch_array($result)) {
if($email == $array["email"]) {
$empty_email = "Ooops! - That email adress allready exists!";
$main_control3 = 1;
break;
mysql_close($starta);
}
}
if($main_control2 != 1 & $main_control = 1 & $main_control3 != 1) {
require ('mysqlcon.php');
$sqlquery=mysql_query("INSERT INTO reg_info (username, password, email) VALUES ('$str', '$password','$email')");
mysql_close($starta);
}
}
}