Jump to content

Search the Community

Showing results for tags 'calculation'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start





Website URL








Donation Link

Found 3 results

  1. Say I have 5 users. Each user will receive their payment based on their individual percentage. For eg. User 1: 5% User 2: 10% User 3: 15% User 4: 15% User 5: 5% Now say I have a total of $100. I want to divide the $100 among the 5 users. But the users with higher % will receive a higher amount than the the ones with lower %. How would I calculate this?
  2. I'm trying to make a diesel consumption scoreboard for the drivers in our company, but not sure how I can sort the drivers by average fuel consumption. I have two database tables, one for the members and one for the fuel data. I'm using this sql query to calculate the average, but I would like to have some more information in the same query and also a way to easily sort the members by their average fuel consumption to complete the scoreboard. SELECT 10 * SUM(liter) / (MAX(km) - MIN(km)) as AvgFuel FROM diesel WHERE diesel.dato >= '$dx' AND userid = ".$_COOKIE['userid']."; In the diesel table there are information like km, liters, dates, locations etc. How can I extend this query to have more information instead of having multiple queries ? (I'm a newbie) Thanks for reading!
  3. Hello, Let me explain with an example. Lets say I have an Image of size 960px X 668px I have a div which holds this image. The div size is 154px X 75px This div can have any variable size. If we see that the aspect ratio of image and the aspect ratio of the div that holds image are different. All i need to do is Resize and Crop the Image in such a way that it takes maximum possible height and width of the original size and also maintain the aspect ratio of the div that holds this image. I just need a logic to calculate a percentage that by how much DIV width and height should be multiplied so that the resulting size is closer to the image size but doesnot exceed the image size and also the aspect Ratio will be same as that of DIV but not of image.. The motive to do this is that image exactly fits the div when scaled to div's size without stretching or disorting the image. Thanks watsmyname
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.