The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Counting Timestamps?
I'm working on that ranking script that I've been asking for the past couple of months...
One of the things I want to do, when I am calculating the rankings... I want to outdate older events... Events are all given a unix timestamp... I am using the following code to calculate rankings... and so far its working great... Code:
SELECT * FROM rank_scores INNER JOIN rank_events ON(rank_scores.eventID = rank_events.eventID) WHERE rank_scores.playerID = ".$player['playerID']." ORDER BY sValue DESC, eDate DESC (currentTime - eDate) < $countDmod months I defined the $countDmod variable as 12 in my config file. So what this should do, it will take the current date, subtract the date of the event from it... and if the remaining value is less than 12 months; it will add it to the SELECT statement, otherwise skip it. How do I program this? |
#2
|
||||
|
||||
PHP Code:
FROM rank_scores INNER JOIN rank_events USING (eventID) WHERE rank_scores.playerID = $player[playerID] AND eDate > $cutoff ORDER BY sValue DESC, eDate DESC[/sql] |
#3
|
|||
|
|||
Thanks man! Thats exactly what I am looking for... but now I am having another issue...
I have 3 files... /includes/config.php /includes/function_player.php /player.php 2 variables are declared and set in config.php: $countEmod and $countDmod... config.php and function_player.php are called in /player.php with Code:
require_once('./includes/config.php'); require_once('./includes/functions_player.php'); Code:
fetch_player($player); Is there something I have to do, to get the global variables to work inside the function? |
#4
|
||||
|
||||
You must use the global keyword to bring the variables into scope.
PHP Code:
|
#5
|
|||
|
|||
Ah... kick ass...
I'm a PERL programmer by heart... PHP is just foreign to me. |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|