Fatal error: Cannot use object of type mysqli_result as array
<p>I am trying to get the result from my database table <code>tbl_newpage</code> but it throws error. I don't know why it throws error</p>

<p>The following line </p>

<pre><code>   $page = $mysqli-&gt;real_escape_string($_GET['page']);

   $result=array();

   if($stmt = $mysqli-&gt;prepare("select * from tbl_newpage where name=?")){

     $stmt-&gt;bind_param("s", $page);

     $stmt-&gt;execute();

     $result = $stmt-&gt;get_result();

     while($row = $result-&gt;fetch_array()){

       $result[] = array($row); //This is where the error appears 
                echo "hello ";print_r($row);die();

     }

     $objSmarty-&gt;assign("result", $result);
   }
</code></pre>

<p>Throws error</p>

<p>Fatal error: Cannot use object of type mysqli_result as array in <code>/var/www/html/examplesite/phpfile.php</code> on line 22</p>