title: How to fetch data in PHP with MySQLi?
body: <p>I tried several times but cannot succeed in getting the right syntax—according to PHP 5.5.12  —to fetch single or multiple rows from my database.</p>
  
  <pre><code>session_start();
  $con=mysqli_connect("localhost","root","","doortolearn");
  if (!$con) {
      echo "Could not connect to DBMS";       
  }
      $query="select * from teacher where tremail='$_POST[email]' and trpasssword='$_POST[password]'";
      $result=mysqli_query($con,$query);
      $flag=FALSE;
      while ($row=mysqli_fetch_array($result,MYSQLI_BOTH)) {
          $_SESSION['email']=$row['email'];
          $flag=TRUE;
      }
  </code></pre>