title: How to iterate on search results from MySQL by PHP?
body: <p>When I use </p>
  
  <pre><code> function __construct()
      {
        // open db
        $this-&gt;db = new mysqli(DB_HOST, DB_USER, DB_PASSWORD, DB_DATABASE);
        if (!$this-&gt;db)
          die(mysql_error());
  
        $this-&gt;db-&gt;query("SET NAMES 'utf8';");
      }
  
  
  $result=$this-&gt;db-&gt;query("SELECT OrgNo, CompanyName FROM ematch WHERE CompanyName LIKE '%$word%';");
             $num=$result-&gt;num_rows;
            print $num; 
             $i=0;
              while ($i &lt; $num) 
              {
                   $OrgNo=mysql_result($result,$i,"OrgNo");
                   $CompanyName=mysql_result($result,$i,"CompanyName");
                   $i++;
                   print $OrgNo.' '.$CompanyName.'&lt;br&gt;';
              }
  </code></pre>
  
  <p>I get this error:
  Warning: mysql_result(): supplied argument is not a valid MySQL result resource
  and nothing comes out.</p>