Friday, August 23, 2013

PHP mysql bug query

PHP mysql bug query

Hi guys i've been working for straight 12 hours, i can't seem to find fix.
i'm trying to compare user-input to database result for example $username
== $result echo "Username is aldready taken, but the problem is it's
passing through 2 statements without a break, and if i put a break to exit
the loop, it always check for $email == $result2 despite of not entering
any email in the field.
if( isset($_POST['username']) or isset($_POST['email']) )
{
$extract= mysql_query("SELECT username, email FROM users where
username='$username' or email='$email'");
$resultq = mysql_num_rows($extract);
while($row= mysql_fetch_array($extract))
{
$result = $row['username'];
$result2 = $row['email'];
echo " ".$result;
echo " ".$result2;
if ($username == $result )
{
echo " Username is already Taken!";
// break; //whenever i put break, it always gives me the else if
statement echo, despite not entering any email in the field
}
//$pass = $_POST['pass'];
else if($email == $result2 )
{
echo "Email Address is already used!";
// break;
}
else
{
}
}
}

No comments:

Post a Comment