PHP mysql bug query -
hi guys i've been working straight 12 hours, can't seem find fix. i'm trying compare user-input database result example $username == $result
echo "username aldready taken, problem it's passing through 2 statements without break, , if put break exit loop, check $email == $result2
despite of not entering email in field.
if (isset($_post['username']) or isset($_post['email'])) { $extract = mysql_query(" select `username`, `email` `users` `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 taken!"; // break; //whenever put break, gives me else if statement echo, despite not entering email in field } //$pass = $_post['pass']; else if ($email == $result2) { echo "email address used!"; // break; } else { } } }
upgrade mysql either mysqli, or pdo.
however;
$extract= mysql_query("select username, email users username='$username' or email='$email'"); $resultq = mysql_num_rows($extract); if($resultq > 0) { echo 'either username, or email taken!'; return; }
Comments
Post a Comment