PDA

View Full Version : db error


Boofo
02-09-2004, 12:42 AM
Can someone please tell me what is wrong with the syntax in this line? I keep getting db errors from it.


$+++++sult = $DB_site->query("SELECT user.* FROM ".TABLE_PREFIX."user AS user WHERE userid IN (".implode(", ",$+++++adids).")");

g-force2k2
02-09-2004, 02:22 AM
I don't think that the character '+' is a valid character in variable names.

Cheers,
g-force2k2

Boofo
02-09-2004, 02:26 AM
The word that is bleeped out is W H O R E for who read the thread. ;)

g-force2k2
02-09-2004, 02:33 AM
lol, okay, but then I don't believe it is that line that is causing the error, because I tested it and it worked fine, do you have any conflicting lines above or below that could be causing the issue?

Regards,
g-force2k2

Boofo
02-09-2004, 03:31 AM
Got it fixed. It was from the Who viewed this thread hack by Kentaurus and luckily he showed up and fixed it. You're right, it apparently wasn't that line exactly. That line is used in the code addon for his hack that gets the usernames in the html format (like for Admin and Mods and such).

I'm curious, how did you test it if you don't have the hack installed? The reason I'm asking is that it might help me in the future if I run into something like this again. ;)

g-force2k2
02-09-2004, 03:46 AM
I'm curious, how did you test it if you don't have the hack installed? The reason I'm asking is that it might help me in the future if I run into something like this again. ;)

I just added that line of code to a php file of vb3 and its a common query that just selects user columns based upon a particular criteria, at first it required an array to implode so I made one quick, but other then that the query caused no php errors so therefore it couldn't have been that line. php is php works the same in the same conditions, therefore if it doesn't error for me it shouldn't error for you :)

Don't know if I made much sense, but hope that explained it somewhat.

For isntance if you placed:

$userstuff = $DB_site->query ( "
SELECT u.username, u.userid,
p.postid
FROM " . TABLE_PREFIX . "user u
LEFT JOIN " . TABLE_PREFIX . "post p USING (userid)
WHERE postid IN ( 1,2,3,4,5,6,7,8,9,10 )
" ) ;

In one of your scripts it could be said that it works or doesn't work based upon the kind of error you get, besides I do believe that php errors are returned before mysql ones, so even if you got mysql errors you could say the php is fine.

Cheers,
g-force2k2

MindTrix
02-09-2004, 05:15 AM
I use Zend for testing errors, i know some people got issues with it but it points out mistakes like a dream

Boofo
02-09-2004, 06:09 AM
At a hefty cost it does. ;)