I cannot see what is wrong. There must be some code syntax we are not aware of as the query works fine manually. I did see that perhaps quotes were missing around the array element, but that doesn't seem to make a difference. Here's what I've got that shows some of what I've tried to make this work.
Code:
<?php
require ("global.php");
$time = time() - (25 * 24 * 60 * 60);
print "1168888543<br />";
print $time;
print "<br />1170502241";
// $a = $DB_site->query("DELETE FROM privatemessage WHERE dateline < $time");
// $a = $DB_site->query_first("SELECT COUNT(*) AS oldpms FROM privatemessage WHERE dateline < $time");
// print "Total PMs To Be Deleted: $a[oldpms]";
// $a = $DB_site->query("DELETE FROM vbpm WHERE pmtextid IN(SELECT pmtextid FROM vbpmtext WHERE dateline < $time));
// $a = $DB_site->query("DELETE FROM vbpmtext WHERE pmtextid IN(SELECT pmtextid FROM vbpmtext WHERE dateline < $time));
$a = $db->query_read("SELECT COUNT(*) AS oldpms FROM vbul_pm WHERE pmtextid IN(SELECT pmtextid FROM vbul_pmtext WHERE dateline < $time)");
$b = $a[oldpms] + 1;
$c = $a;
print "<br />Total PMs To Be Deleted:<br />" . $a[1];
print $a['oldpms'];
print $b . '<br />' . $c;
if ($a['oldpms'] == 3)
{print '<br />OK<br />';
}
if ($a['oldpms'] <> 3)
{print '<br />Not OK<br />';
}
$a = $db->query_read("SELECT COUNT(*) AS oldpms FROM vbul_pmtext WHERE pmtextid IN(SELECT pmtextid FROM vbul_pmtext WHERE dateline < $time)");
print "Total PMtexts To Be Deleted:";
print $a[oldpms];
?>