Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
  #1  
Old 01-27-2005, 02:32 PM
sabret00the's Avatar
sabret00the sabret00the is offline
 
Join Date: Jan 2003
Location: London
Posts: 5,268
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default = works fine but != messed up the query?

this is the query
PHP Code:
    $grps_newestmembers $DB_site->query("
        SELECT grps_user.groupid,grps_user.userid, user.username, grps_user.join_date,grps_user.mod_queue
        FROM grps_user
        LEFT JOIN user ON (user.userid = grps_user.userid)
        WHERE grps_user.groupid = 
$groupid AND grps_user.mod_queue != 1
        ORDER BY grps_user.join_date DESC
    "
); 
has php stopped supporing != overnight or am i just being stupid and doing something wrong?
Reply With Quote
  #2  
Old 01-27-2005, 02:42 PM
Natch's Avatar
Natch Natch is offline
 
Join Date: Nov 2002
Location: Australia
Posts: 851
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

PHP is fine with it, but SQL prefers NOT (iirc)
Reply With Quote
  #3  
Old 01-27-2005, 02:44 PM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Try "<>" instead of "!="

Lol a lot of different answers

IIRC "<>" is the official SQL notation, "!=" is added later i think (MySQL only???, what version??).

But what happens, you get an error, it don't function like expected?
Reply With Quote
  #4  
Old 01-27-2005, 02:49 PM
sabret00the's Avatar
sabret00the sabret00the is offline
 
Join Date: Jan 2003
Location: London
Posts: 5,268
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by MarcoH64
Try "<>" instead of "!="

Lol a lot of different answers

IIRC "<>" is the official SQL notation, "!=" is added later i think (MySQL only???, what version??).

But what happens, you get an error, it don't function like expected?
still returning nothing

the table looks like this
Code:
groupid   	  userid   	  username   	  join_date   	  mod_queue
7 	10 	sabret00the 	1106842883 	1
7 	64 	user2 	1106661929 	NULL
so it should return the one with NULL in it, shouldn't it?

Quote:
Originally Posted by MarcoH64
But what happens, you get an error, it don't function like expected?
no error it just returns no data
Reply With Quote
  #5  
Old 01-27-2005, 02:58 PM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Are you 100% sure that $groupid contain "7"?

What are the fieldtypes?

Are these userid's in the user table?

PS you could try running it without the test on mod_queue to find where the error is.

Edit try changing that NULL value to 0.
Reply With Quote
  #6  
Old 01-27-2005, 03:43 PM
sabret00the's Avatar
sabret00the sabret00the is offline
 
Join Date: Jan 2003
Location: London
Posts: 5,268
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

groupid is definately 7
fieldtypes, oh mod_queue is set at tinyint(4)
the userid's are in the grps_user table
it works without the mod_queue clause, it's just that that's causing the problem?
even with NULL set as 0 it don't work?
Reply With Quote
  #7  
Old 01-27-2005, 03:47 PM
Dean C's Avatar
Dean C Dean C is offline
 
Join Date: Jan 2002
Location: England
Posts: 9,071
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Change this:

PHP Code:
 $grps_newestmembers $DB_site->query("
        SELECT grps_user.groupid,grps_user.userid, user.username, grps_user.join_date,grps_user.mod_queue
        FROM grps_user
        LEFT JOIN user ON (user.userid = grps_user.userid)
        WHERE grps_user.groupid = 
$groupid AND grps_user.mod_queue != 1
        ORDER BY grps_user.join_date DESC
    "
); 
To this:

PHP Code:
 echo("
        SELECT grps_user.groupid,grps_user.userid, user.username, grps_user.join_date,grps_user.mod_queue
        FROM grps_user
        LEFT JOIN user ON (user.userid = grps_user.userid)
        WHERE grps_user.groupid = 
$groupid AND grps_user.mod_queue != 1
        ORDER BY grps_user.join_date DESC
    "
); 
Show us what it outputs to the browser
Reply With Quote
  #8  
Old 01-27-2005, 03:50 PM
sabret00the's Avatar
sabret00the sabret00the is offline
 
Join Date: Jan 2003
Location: London
Posts: 5,268
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Code:
SELECT grps_user.groupid,grps_user.userid, user.username, grps_user.join_date,grps_user.mod_queue FROM grps_user LEFT JOIN user ON (user.userid = grps_user.userid) WHERE grps_user.groupid = 7 AND grps_user.mod_queue != 1 ORDER BY grps_user.join_date DESC
Reply With Quote
  #9  
Old 01-27-2005, 04:01 PM
Dean C's Avatar
Dean C Dean C is offline
 
Join Date: Jan 2002
Location: England
Posts: 9,071
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ok we have some issues with your database model here. You have some data redundancy in the fact you have the username column in this grps_user table. Drop that column as you can get the users username via a join on the userid column. Also change the fieldtype of the mod_queue column to smallint, lenth 1, unsigned and default 0. Then try your query :up:
Reply With Quote
  #10  
Old 01-27-2005, 04:27 PM
sabret00the's Avatar
sabret00the sabret00the is offline
 
Join Date: Jan 2003
Location: London
Posts: 5,268
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

oops, that username was never apart of the grps_user column

here's the table straight from phpmyadmin
Code:
 recordid   	  groupid   	  userid   	  join_date   	  mod_queue
Edit 	Delete 	4 	3 	10 	1102848936 	NULL
Edit 	Delete 	3 	2 	10 	1102848632 	NULL
Edit 	Delete 	13 	6 	10 	1106781470 	NULL
Edit 	Delete 	12 	3 	64 	1106777848 	NULL
Edit 	Delete 	9 	2 	64 	1106568571 	NULL
Edit 	Delete 	10 	7 	64 	1106661929 	NULL
Edit 	Delete 	14 	6 	64 	1106781499 	0
Edit 	Delete 	16 	7 	10 	1106842883 	1
now i just ran a query to change al them nulls to 1 and it never worked, i think theirs something seriously wrong with the mod_queue column

i'm gonna try and delete it and reinstall it, as i have no idea why it won't work still.

works fine now changed it to in_mod_queue just to be safe and it's working fine.

thank you everyone, sorry to waste your time.
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 11:19 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04465 seconds
  • Memory Usage 2,259KB
  • 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
  • (3)bbcode_code
  • (3)bbcode_php
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)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