Help - Search - Members - Calendar
Full Version: Msql NOT IN
HTMLHelp Forums > Programming > Databases
kryles
Hi,

I have a mysql statement that looks like

CODE

SELECT pID,pName,pImage
FROM products
WHERE pSection = 'sectionID' AND pDisplay = '1' AND pName NOT IN('bubble','bobbole','rewjd')


Is this supposed to give me all values not in the list provided or have I missed something? It is actually running in PHP code but it does not seem to filter out the specified values.

Thanks,

[since this is html I didn't post the PHP code, but I can if you want]
kryles
CODE

$query = "    SELECT pID,pName,pImage
                                        FROM products
                                        WHERE pSection = '".$sectionID."' AND pDisplay = '1' AND pName <> '".$rs['pName']."' AND pName NOT IN(".$boughtString.")
                                        ORDER BY RAND()
                                        LIMIT 1";


I am not even sure why this works. But it seems to. smile.gif
Brian Chandler
QUOTE
I am not even sure why this works. But it seems to.


Have you looked in the manual? Or are you just doing guesswork?

This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.