EasyUI Forum

General Category => General Discussion => Topic started by: joe007 on July 28, 2020, 01:47:43 AM



Title: error : Warning: mysqli_fetch_object() expects parameter 1 to be mysqli_result,
Post by: joe007 on July 28, 2020, 01:47:43 AM
Hi,
I got an error on my get_user.php it tells :
Warning: mysqli_fetch_object() expects parameter 1 to be mysqli_result,
it is on command :
while($row = mysqli_fetch_object($db,$rs))
Please Help...
and my script are :

<?php
   $page = isset($_POST['page']) ? intval($_POST['page']) : 1;
   $rows = isset($_POST['rows']) ? intval($_POST['rows']) : 10;
   $offset = ($page-1)*$rows;
   $result = array();

   include '../config/connection.php';
        
    $sql="select count(*) from user";
      $rs = mysqli_query($db,$sql);
   $row = mysqli_fetch_row($rs);

   $result["total"] = $row[0];
   $rs = mysql_query("select * from user limit $offset,$rows");
   
   $items = array();
 
   while($row = mysqli_fetch_object($db,$rs)){
      array_push($items, $row);
   }
   $result["rows"] = $items;

   echo json_encode($result);

?>


Title: Re: error : Warning: mysqli_fetch_object() expects parameter 1 to be mysqli_result,
Post by: joe007 on July 30, 2020, 09:29:14 PM
case closed..
error because of there are 2 variables with same names ($rs)..

thx