php - Cannot echo the column SUM(column_name) as Total -


this query:

$rs = pg_query("select sj.*, sum(p.paid_amount) total, sj.subject_fee - sum(p.paid_amount) balance                 tbl_subject sj, tbl_payment_details p, tbl_student s, tbl_student_block sb                 p.student_block_id = sb.student_block_id , s.student_id = sb.student_id , sj.subject_id = sb.subject_id ,                 sb.student_id = ".$_post['student']." group sj.subject_id order sj.subject_id;"); displayrecordset($rs); 

the problem when echo $r['total'], doesn't show column total in query.

this function:

$counter = 1; while ($r = pg_fetch_array($rs, null, pgsql_assoc)) { $total = $r['total']; ?>   <tr>     <td><?php echo $counter; ?></td>     <td><?php echo $r['subject_id']; ?></td>     <td><?php echo $r['subject_fee']; ?></td>     <td><?php echo $total; ?></td>     <td><?php echo  $r['balance']."balance"; ?></td>     <td>         <a href="<?php echo $_server['php_self']."?subject_id=".$r['subject_id'];?>">edit</a>     </td>   </tr> <?php     $counter++; } 


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -