EasyUI Forum
September 22, 2020, 10:41:15 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: error : Warning: mysqli_fetch_object() expects parameter 1 to be mysqli_result,  (Read 1153 times)
joe007
Newbie
*
Posts: 8


View Profile Email
« 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);

?>
Logged
joe007
Newbie
*
Posts: 8


View Profile Email
« Reply #1 on: July 30, 2020, 09:29:14 PM »

case closed..
error because of there are 2 variables with same names ($rs)..

thx
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!