title: how to check two values in mysql
body: <p>I am using mysql.</p>
  
  <p>I would like to check two values in my <code>users</code> table.</p>
  
  <pre><code>$same_user = "mfalse" ;
  
  $sql=mysql_query("SELECT * FROM users WHERE username='$email' OR phone='$phone'");
          if(mysql_num_rows($sql)&gt;=1)
          {
              $same_user = "mfalse" ;
          }
          else
          {
              $same_user = "mtrue" ;
              mysql_query("SET CHARACTER SET utf8");
              mysql_query("insert into users (username,pass,fname,lname,phone,city)
                VALUES  (N'$email',N'$pass',N'$fname',N'$lname',N'$phone',N'$city')");
          }
  
  
          $arr = array(
          'sameuser'=&gt;$same_user);
  
      return $arr ;
  </code></pre>
  
  <p>in the above my code, the inserted occurs but from <code>$arr</code> I get :</p>
  
  <blockquote>
    <p>{"sameuser":"mfalse"}</p>
  </blockquote>
  
  <p>why ?</p>
  
  <hr>
  
  <p><strong>updated</strong></p>
  
  <p>My function :</p>
  
  <pre><code>function regiterAnUser($an_user){
      //email,pass,fname,lname,phone,city
      $content    = explode("-",$an_user);
      $email      = $content[0];
      $pass       = $content[1];
      $fname      = $content[2];
      $lname      = $content[3];
      $phone      = $content[4];
      $city       = $content[5];
  
      $pass = md5($pass);
  
  
      $same_user = "mfalse" ;
  
      $sql=mysql_query("SELECT * FROM users WHERE username='$email' OR phone='$phone'");
      if(mysql_num_rows($sql)&gt;=1)
      {
          $same_user = "mfalse" ;
      }
      else
      {
          $same_user = "mtrue" ;
          mysql_query("SET CHARACTER SET utf8");
          mysql_query("insert into users (username,pass,fname,lname,phone,city)
            VALUES  (N'$email',N'$pass',N'$fname',N'$lname',N'$phone',N'$city')");
      }
  
  
      $arr = array(
          'sameuser'=&gt;$same_user);
  
      return $arr ;
  }
  </code></pre>