![]() |
Attachment Count in MB
Can anyone please tell me how to pull the MB out of an attachment query? Here is the code for pulling out the KB but I can't seem to find the right code for the MB. I know it is simple, but I must not be very good in the math department.
PHP Code:
|
PHP Code:
|
I had that but I want to get it like 2.12 MB. instead of just 2 MB. How do I get it to go the 2 decimal places?
|
<a href="http://www.php.net/round" target="_blank">http://www.php.net/round</a>
|
I tried that, too. When I round 2,174,891, I get 2 MB. This is how I used round:
PHP Code:
|
Then:
[sql] ...SUM(LENGTH(attachment.filedata)) / 1024 * 1024 * 1024 AS mbytesum... [/sql] ...then round it. :) |
That threw it way off. ;) Here's the code I am working with if that will help.
PHP Code:
|
Use the php modulus operator to work with the remainder.
http://us3.php.net/manual/en/languag...arithmetic.php |
LOL I just tried that and I was way off. All I am trying to do is go 2 decimal places with the MB and have it rouind up if it needs to.
|
Okay, get the sum in bytes, and assume it's in the $bytes variable.
PHP Code:
|
All times are GMT. The time now is 12:55 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|