Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

[RevCMS] Arcturus PHP MySQL

Custom Title Activated
Loyal Member
Joined
Jun 27, 2009
Messages
1,571
Reaction score
170
Hey,

So as you may know Arcturus, is using another table to report online time and other things!

So how do I pull from two different tables

PHP:
SELECT * FROM users and users_currency WHERE `rank` <= '10' and type = 5 ORDER BY `respect` DESC LIMIT 5");

But it's still leaving everything blank
 
Junior Spellweaver
Joined
May 3, 2009
Messages
173
Reaction score
134
Something like this.

PHP:
SELECT username,look,motto,credits,amount FROM users INNER JOIN users_currency ON users.id=users_currency.user_id  WHERE users_currency.type = '5' AND users.rank < 5 ORDER BY users_currency.amount

Why code box is so tiny? :(
 
Upvote 0
Custom Title Activated
Loyal Member
Joined
Jun 27, 2009
Messages
1,571
Reaction score
170
Something like this.

PHP:
SELECT username,look,motto,credits,amount FROM users INNER JOIN users_currency ON users.id=users_currency.user_id  WHERE users_currency.type = '5' AND users.rank < 5 ORDER BY users_currency.amount

Why code box is so tiny? :(

So you've given be a good base! :)

But now when I try to re-edit your code for Online Time

PHP:
<?php
$getTime = mysql_query("SELECT username,look,motto,online_time FROM users INNER JOIN users_settings ON users.id=users_settings.user_id  WHERE users_settings.online_time AND users.rank < 5 ORDER BY users_settings.online_time");
$time = 3600*24; // 60*60*24
while($TimeStats = mysql_fetch_array($getTime)) {
echo '
<tr>
<td width="25%"><img src="http://www.habbo.com/habbo-imaging/avatarimage?figure=' . $TimeStats['look'] . '&size=m&direction32&head_direction=3&gesture=sml" align="left"></td> 
<td width="75%"><a href="{url}/home/'.$TimeStats['username'].'"><b>'.$TimeStats['username'].'</b></a><br />'.$TimeStats['online_time'].' Hours</td>
</tr>';
}
?>

How can I break it down into more accurate timestamp between hours and dates
 
Upvote 0
Junior Spellweaver
Joined
May 3, 2009
Messages
173
Reaction score
134
PHP:
echo date('h \h\o\u\r\s, i \m\i\n\u\t\e\s, s \s\e\c\o\n\d\s', $TimeStats['online_time']);

More about
 
Upvote 0
Junior Spellweaver
Joined
Dec 22, 2007
Messages
160
Reaction score
27
White page means php syntax error. Have u defined $TimeStats. before use it in that code? Check the code again.
 
Upvote 0
Custom Title Activated
Loyal Member
Joined
Jun 27, 2009
Messages
1,571
Reaction score
170
White page means php syntax error. Have u defined $TimeStats. before use it in that code? Check the code again.

PHP:
<?php
$getTime = mysql_query("SELECT username,look,motto,online_time FROM users INNER JOIN users_settings ON users.id=users_settings.user_id  WHERE users_settings.online_time AND users.rank < 5 ORDER BY users_settings.online_time");
$time = 3600*24; // 60*60*24
while($TimeStats = mysql_fetch_array($getTime)) {
echo '
<tr>
<td width="25%"><img src="http://www.habbo.com/habbo-imaging/avatarimage?figure=' . $TimeStats['look'] . '&size=m&direction32&head_direction=3&gesture=sml" align="left"></td> 
<td width="75%"><a href="{url}/home/'.$TimeStats['username'].'"><b>'.$TimeStats['username'].'</b></a><br /><?php echo date('h \h\o\u\r\s, i \m\i\n\u\t\e\s, s \s\e\c\o\n\d\s', $TimeStats['online_time']); ?></td>
</tr>';
}
?>

Error

PHP:
Parse error: syntax error, unexpected 'h' (T_STRING), expecting ',' or ';' in C:\xampp\htdocs\app\tpl\skins\Habbo\topstats.php on line 156
 
Upvote 0
Joined
Aug 10, 2011
Messages
7,401
Reaction score
3,299
Why code box is so tiny? :(

Get a higher resolution screen. :p

Error

PHP:
Parse error: syntax error, unexpected 'h' (T_STRING), expecting ',' or ';' in C:\xampp\htdocs\app\tpl\skins\Habbo\topstats.php on line 156

Cos you're already in an echo 'yadaydadayda <?php echo date(); ?>';

PHP:
<?php
$getTime = mysql_query("SELECT username,look,motto,online_time FROM users INNER JOIN users_settings ON users.id=users_settings.user_id  WHERE users_settings.online_time AND users.rank < 5 ORDER BY users_settings.online_time");
$time = 3600*24; // 60*60*24
while($TimeStats = mysql_fetch_array($getTime)) {
echo '
<tr>
<td width="25%"><img src="http://www.habbo.com/habbo-imaging/avatarimage?figure=' . $TimeStats['look'] . '&size=m&direction32&head_direction=3&gesture=sml" align="left"></td> 
<td width="75%"><a href="{url}/home/'.$TimeStats['username'].'"><b>'.$TimeStats['username'].'</b></a><br />' . date('h \h\o\u\r\s, i \m\i\n\u\t\e\s, s \s\e\c\o\n\d\s', $TimeStats['online_time']) . '</td>
</tr>';
}
?>

But I don't think date() is the correct function as it returns the hours seconds minutes from that timestamp, which right now is the online time in seconds and not a UNIX Timestamp.

I found this on stackoverflow:

Code:
floor($seconds / 3600) . gmdate(":i:s", $seconds % 3600)

So that might work for you I think.
 
Upvote 0
Junior Spellweaver
Joined
May 3, 2009
Messages
173
Reaction score
134
date and gmdate are the same functions. Only difference is the gmdate are based in the GMT.

Anyway, this 'floor($seconds / 3600)' is the correct way, if someone play more than 24h, will return to 0h :p
 
Upvote 0
Back
Top