Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #11  
Old 07-25-2002, 05:05 PM
Logician's Avatar
Logician Logician is offline
 
Join Date: Nov 2001
Location: inside vb code
Posts: 4,449
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

mysql_result should be used once for a variable. Then the assigned var becomes an ordinary variable and you can use it WITHOUT mysql_result.. So you used

PHP Code:
$numberguest=mysql_result($loggedins,0); 
in your code and assign the result to "$numberguest" var which is now an ORDINARY variable. From now on whenever when you want to use $numberguest use it as it is (ie. without mysql_result!)

So replace line echo mysql_result($numberguest,0); to

echo $numberguest;

BTW you else syntax is wrong either: it should be:

PHP Code:
if (mysql_error()) {echo "mySQL error:"; echo mysql_error(); exit;}                                                //show error if any
else
{
echo 
$totalonline ;
echo 
$numbervisible ;
echo 
$numberguest;

Seems you are tired, give it a rest..
Reply With Quote
  #12  
Old 07-25-2002, 05:08 PM
wooolF[RM]'s Avatar
wooolF[RM] wooolF[RM] is offline
 
Join Date: Jan 2002
Posts: 524
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I think MAYBE it's because of $cookietimeout variable... it's not defined any places... what do you think?
Reply With Quote
  #13  
Old 07-25-2002, 05:16 PM
wooolF[RM]'s Avatar
wooolF[RM] wooolF[RM] is offline
 
Join Date: Jan 2002
Posts: 524
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

]well... maybe I'm tired maybe... but I have to get it working...

by now I have no errors anymore! YAY!

but visual results are:

Active Users 0
Active Members
Active Guests 0

And forum tells me this:
Active Users 46
Active Members 24
Active Guests 22


So... maybe you are tired too
Because Active Users and Active Guests working only at 50% (show wrong results) and Active Members doesn't show anything at all...

grrrrrrrrrrrr... why should everything be so difficult? :/
Reply With Quote
  #14  
Old 07-25-2002, 05:37 PM
Logician's Avatar
Logician Logician is offline
 
Join Date: Nov 2001
Location: inside vb code
Posts: 4,449
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

PHP Code:
mysql_connect("$servername""$dbusername""$dbpassword") or die("Couldnt find MYSQL!");
mysql_select_db("$dbname")  or die ("Couldnt find DB!");


// STARTING QUERIES HERE
$aktiveuser mysql_query("SELECT COUNT(userid) FROM user");
$registers mysql_query("SELECT userid, username FROM user ORDER BY userid DESC LIMIT 1");
$datecutmktime (date("H"), date("i")-15date("s"), date("m"), date("d"), date("Y"));
$loggedins=mysql_query("SELECT COUNT(*) AS sessions FROM session WHERE userid=0 AND lastactivity > $datecut");
$numberguest=mysql_result($loggedins,0);
$loggedins=mysql_query("SELECT DISTINCT session.userid,username,invisible,usergroupid
                              FROM session
                              LEFT JOIN user ON (user.userid=session.userid)
                              WHERE session.userid>0 AND session.lastactivity>
$datecut
                              ORDER BY invisible ASC, username ASC"
);
while (
$loggedin=mysql_fetch_row($loggedins)) {
    
$numberregistered++;
    if (
$loggedin[2]==0) {$numbervisible++;}
}
$totalonline=$numberregistered+$numberguest;
$numberinvisible=$numberregistered-$numbervisible;
// END OF QUERIES HERE

echo 'totalonline='.(int)$totalonline; echo("<br><br>");
echo 
'numbervisible='.(int)$numbervisible; echo("<br><br>");
echo 
'guests='.(int)$numberguest; echo("<br><br>"); 
Reply With Quote
  #15  
Old 07-25-2002, 07:20 PM
wooolF[RM]'s Avatar
wooolF[RM] wooolF[RM] is offline
 
Join Date: Jan 2002
Posts: 524
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

]you're the man, Logician! worked perfectly...

as you see, it's not easy to get it working... u have to use different ways... well... that's PHP...

anyway, THANX A LOT!!! I really appreciate your help
Reply With Quote
Reply


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

Forum Jump


All times are GMT. The time now is 12:41 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04156 seconds
  • Memory Usage 2,239KB
  • Queries Executed 14 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (3)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (5)post_thanks_box
  • (5)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (5)post_thanks_postbit_info
  • (5)postbit
  • (5)postbit_onlinestatus
  • (5)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete