The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
How to combine 2 queries into one datastore
I have this script in /cron that will query the database and update the datastore
Code:
<?php if (!is_object($vbulletin->db)) { exit; } else { $db = &$vbulletin->db; } $totalapps = 0; $programstats = array(); $appresult = $db->query_read(" SELECT programid , COUNT(*) AS apps FROM " . TABLE_PREFIX . "application GROUP BY programid "); while ($program = $db->fetch_array($appresult)) { $totalapps += $program['apps']; $programstats[$program['programid']] = $program['apps']; } build_datastore( 'appstats', serialize(array('total' => $totalapps, 'programs' => $programstats)), true ); Code:
$avgtime = $db->query_read(" SELECT programid, ceil(avg((resultdate-datesubmitted)/86400)) as average FROM application where finalresult ="Admit" OR finalresult ="Reject" AND resultdate > 0 group by programid "); Thanks a lot |
#2
|
|||
|
|||
Can anyone help?
Thanks |
#3
|
||||
|
||||
Hey, still playing catch up on the emails.
This should do it: PHP Code:
|
#4
|
|||
|
|||
Thanks for your help, Adrian. There is no better person to answer this than you
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|