The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Msql NOT IN, is this a function recognized by MYSQL 4.X?
kryles
post Mar 13 2008, 03:19 PM
Post #1


Novice
**

Group: Members
Posts: 21
Joined: 30-November 07
Member No.: 4,437



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]
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
kryles
post Mar 14 2008, 12:24 PM
Post #2


Novice
**

Group: Members
Posts: 21
Joined: 30-November 07
Member No.: 4,437



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
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Brian Chandler
post Mar 14 2008, 02:10 PM
Post #3


Jocular coder
*******

Group: Members
Posts: 1,431
Joined: 31-August 06
Member No.: 43



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?

User is online!PM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 21st November 2009 - 03:23 AM