Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
  #1  
Old 05-16-2002, 03:24 AM
aspire007 aspire007 is offline
 
Join Date: Feb 2002
Posts: 31
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default mysql error

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
Reply With Quote
  #2  
Old 05-16-2002, 05:38 AM
Mark Hensler's Avatar
Mark Hensler Mark Hensler is offline
 
Join Date: Oct 2001
Location: California
Posts: 205
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well, the problem is that he doesn't have anything finishing this statement:
userid<>

userid is not equal to what?
Reply With Quote
  #3  
Old 05-16-2002, 08:37 AM
Logician's Avatar
Logician Logician is offline
 
Join Date: Nov 2001
Location: inside vb code
Posts: 4,449
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

After correcting what Mark has mentioned, check ORDER BY RAND() part too.. This is wrong either..
Reply With Quote
  #4  
Old 05-16-2002, 11:47 AM
aspire007 aspire007 is offline
 
Join Date: Feb 2002
Posts: 31
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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?
Reply With Quote
  #5  
Old 05-16-2002, 11:53 AM
Lesane's Avatar
Lesane Lesane is offline
 
Join Date: Oct 2001
Location: The Netherlands
Posts: 1,149
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That's the hack from firefly: Member of the day

The code is good, could u post the lines above that code starting by "// start member of the day stuff"?
Reply With Quote
  #6  
Old 05-16-2002, 01:05 PM
Admin's Avatar
Admin Admin is offline
Coder
 
Join Date: Oct 2023
Location: Server
Posts: 1
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally posted by Logician
After correcting what Mark has mentioned, check ORDER BY RAND() part too.. This is wrong either..
[minicode]ORDER BY RAND()[/minicode] is perfectly fine.
Reply With Quote
  #7  
Old 05-16-2002, 02:57 PM
aspire007 aspire007 is offline
 
Join Date: Feb 2002
Posts: 31
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #8  
Old 05-16-2002, 11:03 PM
aspire007 aspire007 is offline
 
Join Date: Feb 2002
Posts: 31
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

oki got this one taken care of
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 12:40 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04660 seconds
  • Memory Usage 2,223KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (8)post_thanks_box
  • (8)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (8)post_thanks_postbit_info
  • (8)postbit
  • (8)postbit_onlinestatus
  • (8)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete