• Register
Welcome to Kodlogs, programming questions and answer website.
0 votes
21 views
With php and mysql code i am getting following message:

  warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in

 <?PHP

require_once('../connect.php');

$fileList20 = array();

$userId=4;

$qry = "Select user_name, rpt_name  FROM data_reports_users where userId=$userId";

$r = mysqli_query($dbc,$qry);

while ($row = mysqli_fetch_array($r, MYSQLI_ASSOC)){

$fileList20[] = $row['rpt_name'];

}

mysqli_free_result($r);

mysqli_close($dbc);
by (550 points)  

1 Answer

0 votes

Solution:

use following code after mysqli_query() . This code will help to debug the problem. Example

$r = mysqli_query($dbc,$qry)

or die("Error: ".mysqli_error($dbc));

by (5.3k points)  
...