The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
what's wrong with this query?
even when i use the echo to read it via the top of the page it stops at the table prefix.
[sql] SELECT username, userid, email FROM prs_users LEFT JOIN " . TABLE_PREFIX . "user AS user ON (user.userid = prs_users.userid) WHERE prs_users.subscriptions LIKE = "% $display[pieceid] %" AND userid != $getparentinfo[userid] [/sql] and i'm calling it like this PHP Code:
|
#2
|
||||
|
||||
Could you post the exact error message?
Also, could it be that prs_users also needs a TABLE_PREFIX? |
#3
|
||||
|
||||
here you go
PHP Code:
|
#4
|
||||
|
||||
Tough to say, however it would at least read a little better and be easier to troubleshoot written like this:
PHP Code:
Hell, this may actually make it harder for you to troubleshoot - I just thought I would trow it in as its the style I would use. I point to note is that "% $display[pieceid] %" would have given you problems for a number of reasons (in fact, it shouldnt have compiled). HTH's m8 |
#5
|
||||
|
||||
funnily enough i just changed it to read a bit better with this
PHP Code:
Quote:
though now i'm getting Code:
Database error in vBulletin 3.0.7: Invalid SQL: SELECT user.username, prs_users.userid, user.email FROM prs_users LEFT JOIN user AS user ON (user.userid = prs_users.userid) WHERE prs_users.subscriptions LIKE = '% 1 %' AND prs_users.userid != 0 mysql error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '= '% 1 %' AND prs_users.userid != 0' at line 4 mysql error number: 1064 nevermind the problem was the = <--- thanks again |
#6
|
|||
|
|||
The best and most valid way to write this query would be:
[SQL]$thesubscribed = $DB_site->query (" SELECT p.username, p.userid, p.email FROM prs_users p LEFT JOIN " . TABLE_PREFIX . "user AS user ON (user.userid = p.userid) WHERE p.subscriptions LIKE '%" . $display[pieceid] . "%' AND p.userid != '" . $getparentinfo[userid] . "' ");[/SQL] |
#7
|
||||
|
||||
Quote:
|
#8
|
|||
|
|||
Quote:
ohh and yes like mentioned before, TABLE_PREFIX on all tables. |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|