php - I don't know what's wrong with this code SQL -


i'm new php , mysql, reason checks statement if($email == $result2 ) wether input username or email. don't know why? can explain logically, i'm stuck hours figuring out. :( please kind.

<?php  session_start(); include_once("connect.php");  $email = $_post['email']; $username = $_post['username']; //echo $_post['email'];    if(isset($_post['email']) ) { $extract= mysql_query("select username, email users"); $resultq = mysql_num_rows($extract); while($row= mysql_fetch_array($extract)) {      $result = $row['username'];     $result2 = $row['email'];       //$pass = $_post['pass'];      if($email == $result2 )      { //check if there entry username         echo "email address used!";         exit(); //break;     }     if ($username == $result )     {         echo " username taken!";             //mysql_query("insert users (username, password) values ('$user', '$pass')");             //header("location:index.php");         exit(); //break;     }     else     {      } } 

}

it's behaving written. if either if() test succeeds, tell script exit().

remove exit() calls...

you really need learn where clauses in queries. sucking across entire user table , comparing records 1 @ time. equivalent of driving grocery store, buying entire store's inventory, driving home... throwing in garbage because wanted 1 candy bar.


Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -