![]() |
Are you getting an sql syntax error or a php syntax error?
You're trying to select the rows from subscribethread for only one user so you really only need to check the usergroupid and either do the query or not. If you don't have the usergroupid for that user available then you do save one query by combining it like that, but since this is for something that is executed rarely compared to everything going on on the forum, it might be a better idea to do two separate queries and have the code be less complicated. Having said all that, the way you have it is doing a join to the UPDATE query, but the WHERE goes with the select, so it will probably tell you that there's no column named 'usergroupid'. Maybe you should do this instead: Code:
INSERT INTO " .TABLE_PREFIX. "unsub_subscribethread AS unsub_subscribethread |
Hmmm so it would be better to run the check before executing any of the queries (I was planning on excluding those user groups from each query) instead of building the conditional into the query? I suppose I should go a step further and create a setting to allow admins to exclude certain user groups, what do you guys think?
My thinking was that since the subscribethread table doesn't have the usergroupid column, that I needed to call if from the user table. But I don't see why you went with user.userid = unsub_subscribethread.userid? I'm pretty much stalling on this due to the fact that I just can't seem to wrap my head around the proper loop. I've done some reading and I've searched for examples, but nothing I have found seems to have "clicked" with my brain yet :D |
Quote:
Quote:
Quote:
|
Don't worry about dumping this on me, I'll eventually either figure out the loop or ask you to figure it out for me :D
Your reason for editing the post has me intrigued ;) Now back to the JOIN statement just for clarification since I'm almost done setting up the exclude user groups settings :) user.userid = unsub_subscribethread.userid ... I thought that this would only pull the userid from the user table, hence my confusion. The entire point of joining the user table was to grab the usergroupid for use in checking user groups in the query. I am assuming that is how JOIN works (grabbing only the column listed in the ()'s ) but I also assumed that I would be done with this mod by now :D |
Quote:
Quote:
|
AH I see what happened here, you were referring to the code I pasted (#86) showing a failed attempt at looping :D
I should've mentioned that I scrapped that bit of code and my question regarding the LEFT JOIN was for the code in post #89 :) But it's a moot point now, I get the gist of what you were saying in regards to the LEFT JOIN :) |
I'm getting a parse error when I have this code un-commented, I suspect it's the LEFT JOIN but then again what do I know :D
I'm trying to join the user table to pull the email column so the mod doesn't return the email error if there is no email column in the table. Code:
// If you selected to change existing thread subscriptions this code will be executed |
Your ON clause is wrong, one of the fields needs to be from the subscribethread table.
|
Thanks for replying squid :) I changed the ON clause and still have a parse error :(
Code:
// If you selected to change existing thread subscriptions this code will be executed Code:
(user.email = subscribethread.userid) |
Quote:
Code:
ON user.userid = subscribethread.userid |
All times are GMT. The time now is 06:06 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 | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|