Retrieve data from db and display it in a table. this code throws errors

<?php
$query = "SELECT * FROM members WHERE email = '".$_SESSION['email']."'' ";
	$result = mysqli_query($connect,$query);
	while($run_list = mysqli_fetch_array($result)){
		$m_id = $run_list['id'];
		$m_acc_name = $run_list['account_name'];
		//$m_currency = $run_list['#'];
        $m_bank = $run_list['bank'];
        $m_acc_number = $run_list['account_number'];
        $m_phone = $run_list['phone'];
	
?>
    <tr> <td ><?php echo $m_id;?></td>
         <td><?php echo $m_acc_name;?></td>
         <td></td>
         <td><?php echo $m_bank;?></td>
         <td><?php echo $m_acc_number;?></td>
         <td><?php echo $m_phone;?></td>
     </tr>
     <?php
}
     ?>
</table>

It would help if you show what errors you’re getting…

here’s the error
Warning: mysqli_fetch_assoc() expects parameter 1 to be mysqli_result, boolean given in C:\xampp\htdocs\naira pay\maindashboard.php on line 112

Must be the query is failing

http://php.net/manual/en/mysqli.query.php

Return Values

Returns FALSE on failure. For successful SELECT, SHOW, DESCRIBE or EXPLAIN queries mysqli_query() will return a mysqli_result object. For other successful queries mysqli_query() will return TRUE.

But I don’t see how you would be getting an mysqli_fetch_assoc error when your code is using mysqli_fetch_array

yupp, it’s the '' at the end. wouldn’t have happend if prepared statements were used.

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.