The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
I know why, but can't figure out a workaround..
I know why this query returns 'Array', but I can't figure out how to get around it.
PHP Code:
I tried: PHP Code:
I looked at the code of Babstats, and eventually found the function which determines the rank from the rating (which I copied the syntax of, see above function getRank() ). PHP Code:
Thanks for any help. |
#2
|
||||
|
||||
The array it returns is the database row for that rank. So....
return $rank['id']; unless you want it to return something other than id, just replace $rank['id'] with whatever field you want. |
#3
|
|||
|
|||
OMG it worked! Thank you!
|
#4
|
|||
|
|||
Possible to get a format like this: 1 day, 7 hours, 35 minutes from a total of seconds?
i.e., how do I change 15427 seconds into 'x days, x hours, x minutes' ? Thx in advance. |
#5
|
||||
|
||||
$minutes = floor($x / 60) ;
$hours = floor($x / (60 * 60)); $seconds = $x - (hours * 60 * 60); math. |
#6
|
|||
|
|||
Ah, but I suck at math.
Thx very much. edit.- For some reason, this: PHP Code:
Code:
0d, 3h, 210m. |
#7
|
|||
|
|||
Yeah, you have to remove the largest period from the time as you move from, say, days down to seconds, otherwise, you end up counting things more than once.
Try this function. It is a little verbose, but the upside is that it is easier to understand/maintain. (I have not tested this code.) Code:
function get_elapsed_time_string($interval_in_seconds) { $diff = intval($interval_in_seconds); $days = intval($diff / 86400); // div by sec's in a day $diff -= $days * 86400; // then remove that amount $hours = intval($diff / 3600); // div by sec's in an hour $diff -= $hours * 3600; // remove the amount $minutes = intval(($diff +15) / 60); // roundup: 45secs = 1 min return "$days d, $hours h, $minutes m"; } |
#8
|
|||
|
|||
Wonderful. You guys are amazing. Thanks!
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|