PDA

View Full Version : complex sched task, need vb to execute 4 sql queries in one connection


bulbasnore
07-06-2008, 12:22 AM
This works great in phpmyadmin, but if I enclose all statements together or individually in
$vbulletin->db->query_write("
<statements>
");

noting happens (no errors, task mgr reports running just no results).

Any clues? Does vB not support creating temp tables in this way?

create temporary table infraction6mo
(iID Integer Primary Key,
iName varchar(255),
iTot integer);

Insert into infraction6mo
SELECT infraction.userid as iID, user.username as iName,SUM( infraction.points ) AS iTot
FROM `user`,`infraction`
WHERE infraction.dateline > (unix_timestamp()-15724800) and user.userid = infraction.userid and infraction.action = 1
GROUP BY infraction.userid
ORDER BY itot DESC;
update user set adminoptions = 1 where usergroupid = 2;
update infraction6mo,user set user.adminoptions = 0
WHERE infraction6mo.iID = user.userid and infraction6mo.iTot >= 30;

Dismounted
07-06-2008, 06:08 AM
Just split them up into four function calls.