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

  • Home
  • SEARCH
  • 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 9211287
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T01:15:38+00:00 2026-06-18T01:15:38+00:00

how to round figure mysql result value $earnedbasic=$runrows[‘salary’]/$runrows[‘days’]*$runrows[‘countdaystotal’]; example: salary divide by days multiply

  • 0

how to round figure mysql result value

$earnedbasic=$runrows['salary']/$runrows['days']*$runrows['countdaystotal'];

example: salary divide by days multiply by workingdays

150 salary
29 days
30 workingdays

150/29x30=155.17241

if result is like that
so i want round figure the value example now 155.17241 and i want like that 155.173 only
please help me to fix this issue

<?php



       while ($runrows = mysql_fetch_assoc($run))
       {

        //get data
       $workerid = $runrows['workerid'];
       $keywords = $runrows['keywords'];
       $salary =  $runrows['salary'];
       $days = $runrows['days'];
       $countdaystotal = $runrows['countdaystotal'];
       $earnedbasic=$runrows['salary']/$runrows['days']*$runrows['countdaystotal'];


 echo "<table class='sortable' border='1' cellpadding='10'>";
        echo "<tr> <th>ID</th> <th>Name</th><th>Basic</th><th>Days</th> <th>Earned Basic</th><th>Total Salary</th></tr>";


     echo "<tr width='50%' onmouseover=\"this.style.backgroundColor='#999999';\" onmouseout=\"this.style.backgroundColor='#d4e3e5';\"><td width='20%'><a href=\"detail.php?id=$id\" class=\"style1\">$workerid</a></td>
     <td width='20%'>$keywords</td>
    <td width='20%'>$salary</td>
     <td width='20%'>$countdaystotal</td>
     <td width='20%'>$earnedbasic</td></tr>";


echo "</table>";
       }

     }



    }


?>
  • 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-18T01:15:39+00:00Added an answer on June 18, 2026 at 1:15 am
    <td width='20%'>".round($earnedbasic, 3)."</td>
    

    or

    $earnedbasic=round($runrows['salary']/$runrows['days']*$runrows['countdaystotal'],3);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

round(45.923,-1) gives a result of 50. Why is this? How it is calculated? (sorry
How do I round numbers up or down depending on the value in object
I want to round a float number to a given precision, for example :
Is it possible to easily round a figure up to the nearest 100 (or
$result = floatval(mysql_query($query)) The above is a statement to retrieve a float value from
While trying to figure out how to round a float like 1.255 to the
I have been searching round the internet for days on this matter but I
I'm trying to figure out how to round up the total to two decimal
Is there any slick way to round down to the nearest significant figure in
Is it possible for a string to hold around 250000 ( a round figure)

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.