View Full Version : mysql error
aspire007
05-16-2002, 03:24 AM
dont know what to do but here is the error
Database error in vBulletin 2.2.5:
Invalid SQL: SELECT userid,username
FROM user
WHERE userid<>
AND (usergroupid=5
OR usergroupid=6
OR usergroupid=7
OR usergroupid=2)
ORDER BY RAND()
LIMIT 1
mysql error: You have an error in your SQL syntax near 'AND (usergroupid=5
OR usergroupid=6
' at line 4
mysql error number: 1064
Mark Hensler
05-16-2002, 05:38 AM
Well, the problem is that he doesn't have anything finishing this statement:
userid<>
userid is not equal to what?
Logician
05-16-2002, 08:37 AM
After correcting what Mark has mentioned, check ORDER BY RAND() part too.. This is wrong either..
aspire007
05-16-2002, 11:47 AM
in the file index.php where it is refering me i see this --
$newmember=$DB_site->query_first("SELECT userid,username
FROM user
WHERE userid<>$daybits[1]
AND (usergroupid=5
OR usergroupid=6
OR usergroupid=7
OR usergroupid=2)
ORDER BY RAND()
LIMIT 1");
can you guys tell me what you would do? i didnt understand what you meant?
Lesane
05-16-2002, 11:53 AM
That's the hack from firefly: Member of the day (https://vborg.vbsupport.ru/showthread.php?s=&threadid=34779)
The code is good, could u post the lines above that code starting by "// start member of the day stuff"?
Admin
05-16-2002, 01:05 PM
Originally posted by Logician
After correcting what Mark has mentioned, check ORDER BY RAND() part too.. This is wrong either..
ORDER BY RAND() is perfectly fine.
aspire007
05-16-2002, 02:57 PM
sure :) here is the whole member of the day hack i have on my index.php
// start member of the day stuff
$thisdate=date('Y-m-d');
$getdaytemplate=$DB_site->query_first("SELECT template
FROM template
WHERE title='memberoftheday'
AND templatesetid=-2");
$daytemplate=$getdaytemplate['template'];
$daybits=explode('||vb||',$daytemplate);
if ($daybits[0]!=$thisdate or ($resetmember==1 and $bbuserinfo['usergroupid']==6)) {
/* This template is either outdated or the admin wants to reset it.
Either way, we need to choose a new member of the day. Aren't you excited?! */
$newmember=$DB_site->query_first("SELECT userid,username
FROM user
WHERE userid<>$daybits[1]
AND (usergroupid=5
OR usergroupid=6
OR usergroupid=7
OR usergroupid=2)
ORDER BY RAND()
LIMIT 1");
$newtemplate=$thisdate.'||vb||'.$newmember['userid'].'||vb||'.$newmember['username'];
$DB_site->query("UPDATE template
SET template='".addslashes($newtemplate)."'
WHERE templatesetid=-2
AND title='memberoftheday'");
$memberoftheday['userid']=$newmember['userid'];
$memberoftheday['username']=$newmember['username'];
} else {
$memberoftheday['userid']=$daybits[1];
$memberoftheday['username']=$daybits[2];
}
// end of member of the day stuff
aspire007
05-16-2002, 11:03 PM
oki got this one taken care of :)
vBulletin® v3.8.12 by vBS, Copyright ©2000-2024, vBulletin Solutions Inc.