vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   displaying stats in header (https://vborg.vbsupport.ru/showthread.php?t=149499)

Hornstar 06-11-2007 11:52 PM

displaying stats in header
 
Well I am trying to display the stats in the header, and I have this part working good
Code:

<td><span class="style7">Members: $numbermembers<br />
          Posts: $totalposts<br />
          Threads: $totalthreads<br />
          Newest Member: <a href="$vboptions[bburl]/member.php?u=$newuserid">
        $newusername</a></span></td>
      </tr>
    </table></td>

However it is not displaying the stats only this:
Members:
Posts:
Threads:
Newest Member:

The reason it is only showing that is because i have the stats code disabled because it keeps giving my site a database error, so im thinking something must be wrong with the code below, any ideas what is wrong or any other ways at showing this info in the header?



Here is my stats code which is giving my site a database error when i have it enabled:
Code:

  <?xml version="1.0" encoding="ISO-8859-1" ?>
- <plugins>
- <plugin active="1" product="vbulletin">
  <title>Forum Stats, Total Online, Get Newest Member Name</title>
  <hookname>global_start</hookname>
- <phpcode>
- <![CDATA[ // forum stats start 
$numbersmembers = $db->query_first("SELECT COUNT(*) AS users,MAX(userid) AS max FROM " . TABLE_PREFIX . "user"); 
$numbermembers = number_format($numbersmembers['users']); 
$counter = $db->query_first("SELECT COUNT(postid) AS posts, COUNT(threadid) AS threads FROM " . TABLE_PREFIX . "post");
$totalposts=number_format($counter['posts']); 
$countthreads = $db->query_first("SELECT COUNT(*) AS threads FROM " . TABLE_PREFIX . "thread");
$totalthreads=number_format($countthreads['threads']); 
// forum stats end 

// total online start 
$datecut = TIMENOW - $vbulletin->options['cookietimeout']; 
$headerguests=$db->query_first("SELECT COUNT(*) AS count FROM " . TABLE_PREFIX . "session WHERE userid=0 AND lastactivity>$datecut"); 
$headerusers=$db->query_first("SELECT COUNT(DISTINCT(userid)) AS count FROM " . TABLE_PREFIX . "session WHERE " . TABLE_PREFIX . "session.userid>0 AND " . TABLE_PREFIX . "session.lastactivity>$datecut"); 
$headerguests=$headerguests[count]; 
$headerusers=$headerusers[count]; 
$totalonline=$headerguests+$headerusers; 
// total online end

// get newest member name and userid start 
$getnewestmember=$db->query_first("SELECT userid, username FROM " . TABLE_PREFIX . "user WHERE " . TABLE_PREFIX . "userid=$numbersmembers[max]"); 
$newusername = $getnewestmember['username']; 
$newuserid = $getnewestmember['userid']; 
// get newest member name and userid end
  ]]>
  </phpcode>
  </plugin>
  </plugins>

I'm sure someone here will have an idea, im lost lol

Hornstar 06-14-2007 07:32 AM

Anyone got a few minutes willing to help?

Hornstar 06-26-2007 09:34 PM

btw here is the database error i get:

Code:

Database error in vBulletin 3.6.7:

Invalid SQL:
SELECT userid, username FROM vb3_user WHERE vb3_userid=81394;

MySQL Error  : Unknown column 'vb3_userid' in 'where clause'
Error Number : 1054
Date        : Saturday, June 9th 2007 @ 06:53:41 PM


Dismounted 06-27-2007 09:17 AM

Find:
PHP Code:

$getnewestmember=$db->query_first("SELECT userid, username FROM " TABLE_PREFIX "user WHERE " TABLE_PREFIX "userid=$numbersmembers[max]"); 

Replace With:
PHP Code:

$getnewestmember=$db->query_first("SELECT userid, username FROM " TABLE_PREFIX "user WHERE userid=$numbersmembers[max]"); 

BTW, the code you have isn't very neat, although non-coders wouldn't care :p.


All times are GMT. The time now is 10:29 PM.

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.00994 seconds
  • Memory Usage 1,726KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_code_printable
  • (2)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (4)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete