The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
Help with query
I setup a $newmembers variable and I want it to display how many users have registered in the last 24 hours but I keep getting errors. Here is the code I am trying to use, any help would be great.
$newmembers=$DB_site->query_first("SELECT COUNT(*) AS count FROM user WHERE joindate>'".(time()-3600*24)."'); |
#2
|
||||
|
||||
What's the error you are getting?
Two notes just off the top...you should be taking into account the TABLE_PREFIX, like shown below, and you don't need single quotes around an integer such as the joindate, so the query would look like: $newmembers = $DB_site->query_first("SELECT COUNT(*) AS count FROM ".TABLE_PREFIX."user WHERE joindate > ".(time()-3600*24)."); |
#3
|
||||
|
||||
Quote:
Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in /home/vhfansco/public_html/vb/modules/stats.php on line 32 What it's doing is giving me this parse error 2 lines past the line of code that I am adding for some reason. I should also mention this is for my stats module on my vbadvanced, still I set it up like all the others. |
#4
|
||||
|
||||
Can you post the surrounding code? i.e. two lines above through about five lines below.
|
#5
|
||||
|
||||
Sure, here's the entire module it's not too big. Hopefully it's okay to post this here, I will use the code tag.
Code:
<?php // ++=========================================================================++ // || vBadvanced CMPS v1.0.0 // || ? 2003-2004 vBadvanced.com & PlurPlanet, LLC - All Rights Reserved // || This file may not be redistributed in whole or significant part. // || http://vbadvanced.com // || Downloaded 08:52, Wed Nov 17th 2004 // || // ++ ========================================================================++ // ######################### Forum Stats ######################### include_once('./includes/functions_forumlist.php'); cache_ordered_forums(1, 0, 0); if (is_array($forumcache)) { foreach ($forumcache AS $forum) { $nthreads += $forum['threadcount']; $nposts += $forum['replycount']; $totalthreads = number_format($nthreads); $totalposts = number_format($nposts); } } $topposter = $DB_site->query_first('SELECT username, posts, userid FROM ' . TABLE_PREFIX . 'user ORDER BY posts DESC LIMIT 1'); $userstats = unserialize($datastore['userstats']); $numbermembers = number_format($userstats['numbermembers']); $newusername = $userstats['newusername']; $newuserid = $userstats['newuserid']; //$newmembers = $DB_site->query_first("SELECT COUNT(*) AS count FROM ".TABLE_PREFIX."user WHERE joindate > ".(time()-3600*24)."); $tdate = vbdate('Y-m-d', TIMENOW); $birthdaystore = unserialize($datastore['birthdaycache']); if (!is_array($birthdaystore) OR ($tdate != $birthdaystore['day1'] AND $tdate != $birthdaystore['day2'])) { include_once('./includes/functions_databuild.php'); $birthdaystore = build_birthdays(); } switch($tdate) { case $birthdaystore['day1']: $birthdays = $birthdaystore['users1']; break; case $birthdaystore['day2']; $birthdays = $birthdaystore['users2']; break; } $birthdays = str_replace(array('member.php', ','), array($vboptions['bburl'] . '/member.php', '<br />'), $birthdays); eval('$home[$mods[\'modid\']][\'content\'] = "' . fetch_template('adv_portal_stats') . '";'); unset($userstats, $birthdays, $birthdaystore, $topposter); ?> |
#6
|
||||
|
||||
i got this worked out, the info is here if anyone is interested. I hate it when i dig for something and find a question and the reply is "nevermind I figured it out" when I need the answer lol. http://www.vbadvanced.com/forum/showthread.php?t=3988
|
#7
|
||||
|
||||
Quote:
." shouldn't be there...oops... |
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|