Please i have an issue with my code. I intend to select all details in my database and loop through to create a table. But i keep getting this error:
Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\donation_details.php on line 10 No donation records found
Please kindly assist. i'll appreciate any assistance i get. Thanks
$connect = mysql_connect("localhost","hifee","kalimat","hifee");
if(!$connect) die('Unable to fetch data');
else{
$donation = array();
$query = "SELECT * FROM tx_transaction";
echo $query;
$result = mysql_query($query);
while($row = mysql_fetch_assoc($result)){
$donation[] = $row;
}
$total_records = count($donation);
if($total_records > 0){
echo '<table>';
echo '<tr>Transaction ID</td>
<td>Amount donated(=N=)</td>
<td>Donation date</td>
<td>Donation status</td>
<td>Response code</td>
<td>Meno</td>
<td>Response details</td>
<td>Donor\'s email</td>
</tr>';
foreach($donation as $value){
echo '<tr />
<td>'.$value['tx_id'].'</td>
<td>'.number_format($value['tx_amount'],2).'</td>
<td>'.$value['tx_date'].'</td>
<td>'.$value['tx_status'].'</td>
<td>'.$value['tx_response_code'].'</td>
<td>'.$value['tx_memo'].'</td>
<td>'.$value['tx_response_details'].'</td>
<td>'.$value['tx_buyer_email'].'</td>
</tr>';
}
echo '</table>';
}else echo 'No donation records found';
}