The Arcive of vBulletin Modifications Site. |
|
|
#1
|
|||
|
|||
|
This is a simple statement to draw some info on a home page regarding user stats .. right now the error i get is
Quote:
Code:
// 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
|
|
#2
|
|||
|
|||
|
bump ..
|
|
#3
|
||||
|
||||
|
[sql]SELECT userid, username FROM myprefix_user WHERE userid=2;[/sql]
|
|
#4
|
|||
|
|||
|
ive seen the page before i was more hoping for somone to point out the error if it jumped out at them ..
I see the section you are pointing out, but how can i also set that syntax in this code. cause it seems the problem is at this section Code:
$headerguests=$db->query_first("SELECT COUNT(*) AS count FROM " . TABLE_PREFIX . "session WHERE userid=0 AND lastactivity>$datecut");
|
|
#5
|
||||
|
||||
|
This is the same error as this thread ;
https://vborg.vbsupport.ru/showthread.php?t=119719 The broken line is this one ; PHP Code:
i.e. TABLE_PREFIX . "userid should be TABLE_PREFIX . "user.userid However, table prefix should not be used in WHERE clauses anyway, instead you should us an AS after the initial table selection, like this ; PHP Code:
PHP Code:
|
|
#6
|
|||
|
|||
|
Paul, thanks this did help me also
|
|
#7
|
||||
|
||||
|
Thank you for the help much appreciated.
|
![]() |
|
|
| X vBulletin 3.8.12 by vBS Debug Information | |
|---|---|
|
|
More Information |
|
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|