How can i get this to show on the page?

Results 1 to 6 of 6
  1. #1
    Sorcerer Supreme UartigZone is offline
    Member +Rank
    Dec 2013 Join Date
    LoserlandLocation
    441Posts

    ! 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


  2. #2
    Evil Italian Overlowrd Droppy is offline
    Grand MasterRank
    Feb 2012 Join Date
    /home/droppyLocation
    2,080Posts

    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.

  3. #3
    Sorcerer Supreme UartigZone is offline
    Member +Rank
    Dec 2013 Join Date
    LoserlandLocation
    441Posts

    Re: How can i get this to show on the page?

    Quote Originally Posted by Droppy View Post
    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:

  4. #4
    Grand Master KyleeIsProzZ is offline
    Grand MasterRank
    Oct 2012 Join Date
    C:Location
    548Posts

    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'));
    Last edited by KyleeIsProzZ; 16-05-15 at 03:39 PM.

  5. #5
    Sorcerer Supreme UartigZone is offline
    Member +Rank
    Dec 2013 Join Date
    LoserlandLocation
    441Posts

    Re: How can i get this to show on the page?

    Quote Originally Posted by KyleeIsProzZ View Post
    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!!

  6. #6
    Evil Italian Overlowrd Droppy is offline
    Grand MasterRank
    Feb 2012 Join Date
    /home/droppyLocation
    2,080Posts

    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.



Advertisement