How can i get this to show on the page?
Hello,
Can anyone show/learn me how i can get a users credits, duckets and diamonds show on the page?
Code:
<?php
$GetRanks = mysql_query("SELECT id,name FROM users WHERE credits,activity_points,seasonal_currency =
ORDER BY id DESC");
while($WhatHere? = mysql_fetch_assoc($GetWhatHere?))
{
I'm not the best on MYSQL at the moment
Re: How can i get this to show on the page?
You should state more stuff, anyways, try this out:
PHP Code:
<?php
$username = "Username Here"; // Here is the username of who you want to get currencies from
$GetRanks = mysql_query("SELECT (credits,activity_points,seasonal_currency) FROM users WHERE username='$username' ORDER BY id DESC LIMIT 1; "); // Here you do the query, which will only select from the row: credits, activity_points and seasonal_currency from users. It will only fetch those who have the username '$username' [which was defined before]. It will get the latest one from the book only, which is ordered by the ID.
while($row = mysql_fetch_object($GetRanks)) // array with each inserted item, returning an object of the inserted row.
{
echo "{$username} have {$row->credits} credits, {$row->seasonal_currency} of seasonal currency,..."; // Here will show everything you need. Username, Credits and seasonal_currency, easily edited. You can do how you want, such as "echo $row->credits;", or however you want.
}
?>
Remember, there's a mysql injection over there, and I really hope you can manage to use it. Anyway, I left it commented for easy editing. If you need more help, do not be affraid to ask.
I didn't understand if you want to do a TOP 10, or whatever, so heres an example of top 10 of richest.
PHP Code:
<?php
$GetRanks = mysql_query("SELECT (username, credits,activity_points,seasonal_currency) FROM users ORDER BY credits DESC LIMIT 10; "); // Here we fetch username, credits, activity_points and seasonal_currency from table users, then we order by credits (big to small). If you want from small to big, use ASC instead of DESC.
while($row = mysql_fetch_object($GetRanks)) // array with each inserted item, returning an object of the inserted row.
{
echo "{$row->username} have {$row->credits} credits, {$row->seasonal_currency} of seasonal currency,..."; // as the example before... Little edited.
}
?>
If it isn't that what you are looking for, as said before, just ask, and I'll be glad to help.
Re: How can i get this to show on the page?
Quote:
Originally Posted by
Droppy
You should state more stuff, anyways, try this out:
PHP Code:
<?php
$username = "Username Here"; // Here is the username of who you want to get currencies from
$GetRanks = mysql_query("SELECT (credits,activity_points,seasonal_currency) FROM users WHERE username='$username' ORDER BY id DESC LIMIT 1; "); // Here you do the query, which will only select from the row: credits, activity_points and seasonal_currency from users. It will only fetch those who have the username '$username' [which was defined before]. It will get the latest one from the book only, which is ordered by the ID.
while($row = mysql_fetch_object($GetRanks)) // array with each inserted item, returning an object of the inserted row.
{
echo "{$username} have {$row->credits} credits, {$row->seasonal_currency} of seasonal currency,..."; // Here will show everything you need. Username, Credits and seasonal_currency, easily edited. You can do how you want, such as "echo $row->credits;", or however you want.
}
?>
Remember, there's a mysql injection over there, and I really hope you can manage to use it. Anyway, I left it commented for easy editing. If you need more help, do not be affraid to ask.
I didn't understand if you want to do a TOP 10, or whatever, so heres an example of top 10 of richest.
PHP Code:
<?php
$GetRanks = mysql_query("SELECT (username, credits,activity_points,seasonal_currency) FROM users ORDER BY credits DESC LIMIT 10; "); // Here we fetch username, credits, activity_points and seasonal_currency from table users, then we order by credits (big to small). If you want from small to big, use ASC instead of DESC.
while($row = mysql_fetch_object($GetRanks)) // array with each inserted item, returning an object of the inserted row.
{
echo "{$row->username} have {$row->credits} credits, {$row->seasonal_currency} of seasonal currency,..."; // as the example before... Little edited.
}
?>
If it isn't that what you are looking for, as said before, just ask, and I'll be glad to help.
Thanks but its like this i want it: https://forum.ragezone.com/cache.php...%2FdMbdfSr.png
Re: How can i get this to show on the page?
First of all on your me page add:
Code:
<li class="credits"><a href="{url}"><small>{coins}</a> Credits</small></li>
<li class="activitypoints"><a href="{url}"><small>{activitypoints}</a> Duckets</small></li>
<img src="{url}/app/tpl/skins/{skin}/images/diamond.png"><a href="{url}"><small> {seasonal_currency}</a> Diamonds</small></li>
and make sure these are added in your class.template.php
Code:
$this->setParams('coins', $users->getInfo($_SESSION['user']['id'] ,'credits'));
$this->setParams('activitypoints', $users->getInfo($_SESSION['user']['id'], 'activity_points'));
$this->setParams('seasonal_currency', $users->getInfo($_SESSION['user']['id'], 'seasonal_currency'));
Re: How can i get this to show on the page?
Quote:
Originally Posted by
KyleeIsProzZ
First of all on your me page add:
Code:
<li class="credits"><a href="{url}"><small>{coins}</a> Credits</small></li>
<li class="activitypoints"><a href="{url}"><small>{activitypoints}</a> Duckets</small></li>
<img src="{url}/app/tpl/skins/{skin}/images/diamond.png"><a href="{url}"><small> {seasonal_currency}</a> Diamonds</small></li>
and make sure these are added in your class.template.php
Code:
$this->setParams('coins', $users->getInfo($_SESSION['user']['id'] ,'credits'));
$this->setParams('activitypoints', $users->getInfo($_SESSION['user']['id'], 'activity_points'));
$this->setParams('seasonal_currency', $users->getInfo($_SESSION['user']['id'], 'seasonal_currency'));
YES! Thank you very much!! :w00t:
Re: How can i get this to show on the page?
Closed since it has been resolved. If you feel it needs to be reopened, PM me and I'll have it reopened for you.