Log in

View Full Version : SQL error - probably hack related...


Natch
05-29-2004, 05:17 AM
I've started getting this error:Database error in vBulletin 3.0.1:

Invalid SQL:
SELECT subscriptionlog.subscriptionid, subscriptionlog.userid, subscriptionlog.expirydate,
user.username, user.email, user.languageid
FROM subscriptionlog AS subscriptionlog
LEFT JOIN user AS user ON (user.userid = subscriptionlog.userid)
WHERE subscriptionlog.expirydate >= 1085982016
AND subscriptionlog.expirydate <= 1086068416
AND status = 1

mysql error: Column: 'status' in where clause is ambiguous

mysql error number: 1052

Date: Saturday 29th of May 2004 12:40:17 AM
Script: http://www.mobileforces.org/forums/cron.php?&rand=923340
Referer: http://mobileforces.org/forums/index.php?It applies randomly across many users and guests - and I'm guessing it is linked to the random running of the cron scripts - but I can't seem to find where the code for this Query is? On looking at the table, I need to add a subscriptionlog. in front of the status reference in the WHERE clause, but I can't find the query ...

Anyone ?

Velocd
05-29-2004, 06:12 AM
cron/subscriptions.php, lines 43-51

// time for the reminders
$subscriptions_reminders = $DB_site->query("
SELECT subscriptionlog.subscriptionid, subscriptionlog.userid, subscriptionlog.expirydate, user.username, user.email, user.languageid
FROM " . TABLE_PREFIX . "subscriptionlog AS subscriptionlog
LEFT JOIN " . TABLE_PREFIX . "user AS user ON (user.userid = subscriptionlog.userid)
WHERE subscriptionlog.expirydate >= " . (TIMENOW + (86400 * 2)) . "
AND subscriptionlog.expirydate <= " . (TIMENOW + (86400 * 3)) . "
AND status = 1
");

If this is indeed your problem, I find it hard to believe it hasn't been corrected yet by the vB devs.

Xenon
05-29-2004, 12:10 PM
hmm, it shouldn't be ambigous normally, iirc there is no status field on the usertable, is there?

so there is no need for the devs to fix anything, as it's not broken in a standard vb3 ;)

to fix it, just replace AND status = 1 with AND subscriptionlog.status = 1

Natch
05-31-2004, 07:36 AM
Thanks guys - all fixed :)

Xenon
05-31-2004, 01:00 PM
you're welcome natch :)