Activity Stream
48,167 MEMBERS
63188 ONLINE
besthostingforums On YouTube Subscribe to our Newsletter besthostingforums On Twitter besthostingforums On Facebook besthostingforums On facebook groups

Results 1 to 7 of 7
  1.     
    #1
    Member

    Default [PHP] Need help to loop true the results

    Thanks in advance!

    The goal is to display a list of items (websites) sorted by most votes.
    I've got this (from here):
    <?php $items = ThumbsUp::items('[quote]')->open(TRUE)->orderby('votes_pct_up desc')->limit(3)->get() ?>

    This would result in:
    PHP Code: 
    array (
      
    => 
      array (
        
    'id' => 653,
        
    'name' => '[quote] scandic',
        
    'closed' => false,
        
    'date' => 1325620171,
        
    'votes_up' => 76,
        
    'votes_down' => 36,
        
    'votes_pct_up' => 67.8571,
        
    'votes_pct_down' => 32.1429,
        
    'votes_balance' => 40,
        
    'votes_total' => 112,
      ),
      
    => 
      array (
        
    'id' => 654,
        
    'name' => '[quote] mozunk',
        
    'closed' => false,
        
    'date' => 1325620171,
        
    'votes_up' => 75,
        
    'votes_down' => 39,
        
    'votes_pct_up' => 65.7895,
        
    'votes_pct_down' => 34.2105,
        
    'votes_balance' => 36,
        
    'votes_total' => 114,
      ),
      
    => 
      array (
        
    'id' => 655,
        
    'name' => '[quote] clarklab',
        
    'closed' => false,
        
    'date' => 1325620171,
        
    'votes_up' => 58,
        
    'votes_down' => 33,
        
    'votes_pct_up' => 63.7363,
        
    'votes_pct_down' => 36.2637,
        
    'votes_balance' => 25,
        
    'votes_total' => 91,
      ),

    I can't figure out how to get this to display on a webpage..
    Reference page: http://tpbmirrors.org/dev.php
    AndroidApps Reviewed by AndroidApps on . [PHP] Need help to loop true the results Thanks in advance! The goal is to display a list of items (websites) sorted by most votes. I've got this (from here): <?php $items = ThumbsUp::items('')->open(TRUE)->orderby('votes_pct_up desc')->limit(3)->get() ?> This would result in: array ( 0 => Rating: 5

  2.   Sponsored Links

  3.     
    #2
    Member
    Website's:
    wscripts.net damnlolscript.com lulzjet.com
    PHP Code: 
    foreach($items as $item) {
    print_r($item); //print array

    echo $item['id']; //echo id
    echo $item['name']; //echo name 



  4.     
    #3
    Member
    Website's:
    sborg.us
    You can also use var_dump in place of print_r

    http://php.net/manual/en/function.var-dump.php

    V3g3ta | Halcyon | Abhi

  5.     
    #4
    Member
    Thanks guys!
    I am however a complete n00b to php
    See http://tpbmirrors.org/dev.php

    How do I get t3od0r's code to display "1 +1 -1"?

    Cheers

  6.     
    #5
    Member
    Website's:
    sborg.us
    Oh well!


    PHP Code: 
    foreach($items as $item) {
    //print_r($item); //print array
    echo $item['id'].' has ';
    echo 
    $item['votes_up'].' positive votes and '//echo positive votes
    echo $item['votes_down'].' negative votes '//echo negative votes
    echo '<br />'//linebreak to make things look a bit better

    Result:

    653 has 76 positive votes and 36 negative votes
    654 has 75 positive votes and 39 negative votes
    655 has 58 positive votes and 33 negative votes

    I hope you got the point. Check tutorials related to arrays in PHP and this will look a lot simpler

    V3g3ta | Halcyon | Abhi

  7.     
    #6
    Member
    Website's:
    imdber.org justpaste.me
    Is that the thumbsup script?

  8.     
    #7
    Member
    Thanks, I'm getting there
    http://tpbmirrors.org/dev.php

    Will update on the progress.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Php Loop Prob
    By Chris2k in forum Web Development Area
    Replies: 1
    Last Post: 16th Jan 2012, 02:00 PM
  2. [JAVA} Need help in a Nested Loop
    By conrey in forum Web Development Area
    Replies: 18
    Last Post: 10th Oct 2011, 09:41 AM
  3. is website outlook express results are true..?
    By torrfriend in forum Webmaster Discussion
    Replies: 2
    Last Post: 13th Aug 2010, 10:06 AM
  4. Google going into infinate loop!
    By jstep2009 in forum General Discussion
    Replies: 3
    Last Post: 28th Aug 2009, 03:36 PM
  5. Redirect loop?!?!
    By GeeZus in forum Technical Help Desk Support
    Replies: 4
    Last Post: 9th Jun 2009, 04:36 AM

Tags for this Thread

BE SOCIAL