![]() |
Basic PHP questions from newbie, help me finish this up
OK, I'm not sure if it's already been done but I'm making something which shows the person with the most posts per day at the top of the forum...
First of all, I've added a new column to the "user" table which has posts per day of each user, and it sticks the user's posts per day in that field and that is the value that shows up on the home page...I am using the following query to generate those numbers: Code:
UPDATE user SET ppd=posts/((UNIX_TIMESTAMP(NOW())-joindate)/86400) Secondly, I need to round the number to the nearest 100th. How can I do that? Thanks... |
Ah come on, nobody knows?
|
you have to add something like that in your index.php:
$DB_site->query("UPDATE user SET ppd=posts/((UNIX_TIMESTAMP(NOW())-joindate)/86400)"); basically i wouldn't do that into index.php, because it is run so often. put it into memberlist.php, i think there you show up the users sorted by ppd right? second: sorry i don't understand what you want, can you explain it a bit more? (sorry, perhaps its my english ;)) |
Thanks...:)
OK, I have a numerical value that I'm pulling from my database and I want to round it to the nearest 100th, like if the value is 29.468384 I want to make it show 29.47. Thanks :) |
i see if you want to round the variable:
$ppd=round($ppd*100)/100; if you just want to show it with two digits use this: $ppd = sprintf("%.2f",$ppd); as located in member.php ;) |
Thanks, figured that out shortly after I posted though ;)
|
:)
np |
All times are GMT. The time now is 01:37 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:
|