Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8132253
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T09:18:12+00:00 2026-06-06T09:18:12+00:00

http://www.koolfree.com/ImageUpload/uploads/1340729929.jpg (Table Image) Hello, I have linked to an Image (because stackoverflow was not

  • 0

http://www.koolfree.com/ImageUpload/uploads/1340729929.jpg (Table Image)

Hello, I have linked to an Image (because stackoverflow was not allowing me to upload due to less than 10 reputation) in which you can see there is a Table with 9 Columns and 3 Rows and the Table is connected to the Database and all the values in the table are stored in the Database.

As you can see there is a Last Column of Total in which I want to display the Multiplication Result of Days and Salary values individually Row-wise.

E.g.

user456 has worked 30 Days and his Salary is 100, so it should multiply 30 by 100 and generate the result i.e. 3000 and the result should be displayed in Last Column of Total <>amount.

Similarly,

user123 has worked 30 Days and his Salary is 250, so it should multiply 30 by 250 and generate the result i.e. 7500 and the result should be displayed in Last Column of Total <>amount.

I have used the following code in the Table and sharing for your assistance.

<?php
/* 
        VIEW.PHP
        Displays all data from 'accounts' table
*/

        // connect to the database
        include('connect-db.php');

        // get results from database
        $result = mysql_query("SELECT * FROM accounts") 
                or die(mysql_error());  

        // display data in table
        echo "<p><b>View All</b> | <a href='view-paginated.php?page=1'>View Paginated</a></p>";

        echo "<table border='1' cellpadding='10'>";
        echo "<tr> <th>No</th> <th>Name & ID</th> <th>Days</th> <th>OverTime</th> <th>Date</th> <th>Salary</th> <th>Edit</th><th>Delete</th><th>Total</th></tr>";

        // loop through results of database query, displaying them in the table
        while($row = mysql_fetch_array( $result )) {

                // echo out the contents of each row into a table
                echo "<tr>";
                echo '<td>' . $row['id'] . '</td>';
                echo '<td>' . $row['keywords'] . '</td>';
                echo '<td>' . $row['title'] . '</td>';
                echo '<td>' . $row['description'] . '</td>';
                echo '<td>' . $row['date'] . '</td>';
                echo '<td>' . $row['salary'] . '</td>';
                echo '<td><a href="edit.php?id=' . $row['id'] . '">Edit</a></td>';
                echo '<td><a href="delete.php?id=' . $row['id'] . '">Delete</a></td>';
                echo '<td><>amount</a></td>';
                echo "</tr>"; 


        } 



        // close table>
        echo "</table>";


?>

Kindly tell me what additions or changes should I made to the codes to generate the requisite result?


http://www.koolfree.com/ImageUpload/uploads/1341093148.jpg

I have attached a link of Screenshot. Kindly see the Screenshot and tell me how can I add multiple jobs per user ID?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T09:18:13+00:00Added an answer on June 6, 2026 at 9:18 am

    Have you tried this:

    ...
                echo '<td>' . $row['salary'] . '</td>';
                echo '<td><a href="edit.php?id=' . $row['id'] . '">Edit</a></td>';
                echo '<td><a href="delete.php?id=' . $row['id'] . '">Delete</a></td>';
                echo '<td>' . $row['title']*$row['salary'] . '</td>';
                echo "</tr>"; 
    ... 
    

    To add the total of all rows in one column you need to use a variable which gets incremented each time the while loop goes through:

        // Declare variable for the place where the value
        // of all the elements of the column are stored
        $Total_total=0;
        // loop through results of database query, displaying them in the table
        while($row = mysql_fetch_array( $result )) {
        ...
                echo '<td>' . $row['title']*$row['salary'] . '</td>';
                echo "</tr>"; 
                //Increment the value of the Total_total variable
                //by the salary value of one row till the while loop finishes
                $Total_total=$Total_total+$row['title']*$row['salary'];
        }
    
        // After the while loop add one more row where the "total's" will be shown
    
        echo "<tr>";
        echo '<td>' . Id column totals . '</td>';
        echo '<td>' . Totals . '</td>';
        echo '<td>' . Totals . '</td>';
        echo '<td>' . Totals . '</td>';
        echo '<td>' . Totals . '</td>';
        echo '<td>' . Totals . '</td>';
        echo '<td>' . Totals . '</td>';
        echo '<td>' . Totals . '</td>';
        echo '<td>' . $Total_total . '</td>';
        echo "</tr>"; 
    
    // Do the same for all the other columns where a total count is needed.
    // 1) Declare variable ("$Total_total=0;")
    // 2) Increment it each time with itself and something you
    // need the totals for when while loop goes through one time 
    //  ("$Total_total=$Total_total+$row['salary'];")
    // 3) Print out the results after the while loop
    //  ("echo '<td>' . $Total_total . '</td>';")
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

http://www.izrada-weba.com/orso On mouseover on link NENATKRIVENA TERASA... submenu and image fade in together. Submenu
http://www.leandrovieira.com/projects/jquery/lightbox/ sample so i have get images in while loop here is my code
http://www.example.com/http://www.test.com I have tried many different methods using .htaccess with no luck. I need
http://www.youtube.com/watch?v=DyssOSmwuoo according to my video when call animation PageTransitionForward it will have a triangle
http://www.devx.com/wireless/Article/39101/0/page/2 I have followed this tutorial and got it to work and everything. now
http://www.question-defense.com/wp-content/uploads/2009/02/intel-945gm-driver.gif how to create an application which displays output which i want the user
http://www.validome.org/xml/validate/?lang=en&viewSourceCode=1&url=http://45143.com/finance-feed/abc.xml&onlyWellFormed=1 check the url above for validator results. Line 171 in the XSD is
http://www.programmersheaven.com/2/FAQ-ADONET Disconnected architecture is not well suited for desktop clients with multiple updates but
http://www.geocities.com/CapeCanaveral/Hall/2027/alfabeto.txt part of it: procedure f /martina go 20 rt 90 go 10 lt
http://www.roguevalleyroses.com/rose_list.php?search_id=&class=&height=&growth=&color=&bloom_size=&bloom_type=&shade=&fragrance=&disease=&rebloom=&thorns=&zone=&hybridizer=Ashdown%20Roses&date_range=&text=&view=&show=&page=4 This is the page. The code that queries the results is here: http://pastebin.com/d51bfa53f

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.