» Log in
User Name:

Password:

Not a member yet?
Register Now!
» Online Users: 55
0 members and 55 guests
No Members online
Most users ever online was 611, 03-21-2008 at 11:10 PM.
» .::.
Web Hosting - web hosting, dedicated servers and web design services
Online Degree - search for 1000+ online degrees, online colleges & online universities.
Tattoo - we are a group of tattoo enthusiasts
Gexa Energy - your absolute best choice in electric service
Texas electricity - save on electric rates
Football Betting - best nfl betting promotions at sportsbook.com.
Oral Chelation - initial cleansing of your veins & arteries
Portatiles - Ofertas en Ordenadores y Portatiles. Increibles Ofertas DELL.

Register Now! Contact Us

About this Page
This is a discussion on Sorting online users within the Nuke 7.x - Blocks forums, part of the PHP-Nuke 7.x category; Hi. I have the user_info block and modified it so that it displays a small U.S. Army rank graphic ...


Go Back   Nukemods Forum » PHP-Nuke 7.x » Nuke 7.x - Blocks

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 10-04-2004, 04:19 PM
Junior Member
 
Join Date: Sep 2004
Posts: 10
Sorting online users
Hi.

I have the user_info block and modified it so that it displays a small U.S. Army rank graphic next to the user that is currently online . The problem I now have is that I want to sort the users according to rank i.e. when a Sergeant comes on he should be displyed above the Privates. Another problem is if two Sergeants are online or two or three Privates I need to sort not only by the rank but also by the lastname. Any suggestions on how I might be able to do this? Both the username and rankimage are in the same table. I have tried ORDER BY but no change.

Here is the part of the script that I have now, you can view the block at www.32bat.com
Code:
$who_online_now = "";
$i = "1";

while ( $session = sql_fetch_array( $result2, $dbi ) )
{
   if ( isset($session["guest"]) and $session["guest"] == 0 )
   {
            $FlagResult = sql_query( "select user_ranksmall from ".$prefix."_users where username = '$session[uname]'", $dbi );
      $FlagInfo =   sql_fetch_array( $FlagResult, $dbi );
      
   
      $FlagPath = "/nuke/images/rankssmall/";
     if ( $FlagInfo[user_ranksmall] == "0" )
   {
          $FlagPathFile = "/nuke/images/flags/guest";}
else
      {

$FlagPathFile = $FlagPath.$FlagInfo[user_ranksmall];
      }

           $resultuser_id = sql_query( "SELECT user_id FROM ".$prefix."_users where username='$session[uname]'", $dbi );
      list( $user_id ) = sql_fetch_row( $resultuser_id, $dbi );
     
      $who_online_now .= "<img src=\"$FlagPathFile.gif\" ><A HREF=\"modules.php?name=Private_Messages&file=index&mode=post&&u=$user_id\">$session[uname]</a>
\n";
      $who_online_now .= ( $i != $member_online_num ? "  " : "" );
      $i++;
   }
}
[/code]
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 10-05-2004, 01:47 PM
Junior Member
 
Join Date: May 2003
Posts: 35
First off your adding alot of queries. Every user needs to run those queries to view the block so lets get rid of the two above. In the bloc above this section you posted look for the main query call to the session table and change that with this one:

Code:
$result = $db->sql_query("SELECT s.uname, s.guest, u.user_id, u.username, u.user_ranksmall FROM $prefix"._session." AS s LEFT JOIN ".$prefix."_users AS u ON u.username = s.uname WHERE guest='0'");
Now we have them all in one query. Now for the ranking you will need to make either another table or another field to associate what rank is what and what order they should list in. Hope that helps.

Telli
__________________
http://codezwiz.com/
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Detailed Users online hartshill Nuke 7.x - General 0 02-15-2005 01:25 PM
Changing order of sorting of Content Pages jib_intelli Nuke 7.x - General 5 12-06-2004 01:50 PM
Module to Display Users Online Status XtraX Nuke 7.x - Modules 0 08-17-2004 08:18 PM
BMan1Blue for Nuke6.5 not correctly show online users pentium4 Theme packs 1 05-09-2003 09:20 AM
In total there are users online (Forum footer) JGNYC Purged Topics 12 01-26-2003 03:38 PM


All times are GMT -5. The time now is 02:36 PM.


Design by Vjacheslav Trushkin, color scheme by ColorizeIt!.

LinkBacks Enabled by vBSEO 3.1.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31