John Davidson

php - i have 2 tables (expenses , expdescription) my question is how to show expenses in table grouped by expenses description

0 comments
Message:


    while($row = mysqli_fetch_array($query))
{
//$sql3 ='select * from description where descid = '.$row['descid'].' ';
$query3 = mysqli_query($conn,$sql3);
$row2 = mysqli_fetch_array($query3);
$total =$total + $row['amount'];
echo ' <tr>
<td style="text-align:center">'.$row['amount'].'</td>
<td style="text-align:center">'.$row2['description'].'</td>
<td style="text-align:center">'.$row['info'].'</td>
<td style="text-align:center">'.$row['DATE'].'</td>
<td style="text-align:center">'.$total.'</td>';


?>
<td><a href="insert.php?delete=<?php echo $row['outid']; ?>"
class ="btn btn-danger">delete</a></td>
<?php
echo '
</tr>';

}
}

this code show me all data from expenses table but
how to write php code to . show all expenses grouped by expense description .



My Answer:





$total) {
$sql2 = 'SELECT * FROM expdescription WHERE descid = '.$descid;
$query2 = mysqli_query($conn, $sql2);
$row2 = mysqli_fetch_array($query2);
echo '';
echo '';
echo '';
echo '';
}
?>
Expense Description Total Amount
'.$row2['description'].''.$total.'

Rate this post

3 of 5 based on 7975 votes

Comments




© 2024 Hayatsk.info - Personal Blogs Platform. All Rights Reserved.
Create blog  |  Privacy Policy  |  Terms & Conditions  |  Contact Us