Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6

Thread: looping

  1. #1
    New Coder
    Join Date
    Jul 2007
    Location
    Masai, Johor, Malaysia
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts

    looping

    okay, i have this..

    <tr class="12">
    <td width="3%"><?php echo $var_i ?></td>
    <td width="3%" height="30" ><?php echo $rs_hptrx_link->Fields('emp_Id');?></td>
    <td width="9%" ><?php echo $rs_hptrx_link->Fields('emp_Name'); ?></td>
    <td width="5%"><?php echo $rs_hptrx_link->Fields('TRX_DATE'); ?></td>
    <td width="5%"><?php echo $rs_hptrx_link->Fields('TRX_CODE'); ?></td>
    <td width="7%"><?php echo $rs_hptrx_link->Fields('AMOUNT'); ?></td>

    my problem is, how can i calculate the AMOUNT value for each TRX_CODE type and display the value inside the table. can anybody help me??please..

  2. #2
    Regular Coder devinemke's Avatar
    Join Date
    Dec 2004
    Location
    NYC
    Posts
    443
    Thanks
    0
    Thanked 12 Times in 11 Posts
    you already have a field called "amount". what other calculation is required?

  3. #3
    New Coder
    Join Date
    Jul 2007
    Location
    Masai, Johor, Malaysia
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts
    i need to calculate the total_amount for each TRX_CODE. Let say TRX_CODE is OT1,OT2,OT3,OT4,...i need to calculate and display the total amount for each amount of the TRX_CODE.

  4. #4
    Supreme Master coder!
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    10,228
    Thanks
    10
    Thanked 1,170 Times in 1,161 Posts
    What kind of database is all of the stuff coming from?

  5. #5
    New Coder
    Join Date
    Jun 2007
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts
    you should be able to just have a counter. That increments as you loop iot.

    But you might be able to do some of this through the database stuff.
    PHP / CSS / Perl / XML / XHTML

    For cheap ipod touch go to protella.com

  6. #6
    New to the CF scene
    Join Date
    Jul 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by NiZAM View Post
    i need to calculate the total_amount for each TRX_CODE. Let say TRX_CODE is OT1,OT2,OT3,OT4,...i need to calculate and display the total amount for each amount of the TRX_CODE.
    Hi NiZAM,
    An easy way to do it is to calculate the sum of [AMOUNT] by modifying same sql statement you used to get the data for your table.

    Hope this help !


 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •