I'm mysql stupid.

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
User avatar
serfczar_
Forum Commoner
Posts: 34
Joined: Sun Feb 25, 2007 5:27 pm
Location: USA, Texas
Contact:

I'm mysql stupid.

Post by serfczar_ »

I was looking through my database yesterday, and I stumbled upon a wordpress table. I got to looking in it, and I found some dropdown menus of specific values that the key could be. I want to know how to tell mysql that a certain key within a table can only be one of so many values, for example.

-->Userlocation
---------------------->products
---------------------->index
---------------------->forums
---------------------->news
---------------------->rss feeds



Anyone have a clue?
User avatar
jayshields
DevNet Resident
Posts: 1912
Joined: Mon Aug 22, 2005 12:11 pm
Location: Leeds/Manchester, England

Post by jayshields »

There is a name for what you are talking about, but for the life of me I can't remember it, or whether it's MySQL that supports it. Either way, I leave things like that to PHP rather than MySQL.
User avatar
serfczar_
Forum Commoner
Posts: 34
Joined: Sun Feb 25, 2007 5:27 pm
Location: USA, Texas
Contact:

Post by serfczar_ »

jayshields wrote:There is a name for what you are talking about, but for the life of me I can't remember it, or whether it's MySQL that supports it. Either way, I leave things like that to PHP rather than MySQL.
Yea, I want to tell mysql to do that with php.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

You're looking for the ENUM or SET column type.
User avatar
serfczar_
Forum Commoner
Posts: 34
Joined: Sun Feb 25, 2007 5:27 pm
Location: USA, Texas
Contact:

Post by serfczar_ »

feyd wrote:You're looking for the ENUM or SET column type.
Thanks how do I use enum?
User avatar
Kieran Huggins
DevNet Master
Posts: 3635
Joined: Wed Dec 06, 2006 4:14 pm
Location: Toronto, Canada
Contact:

Post by Kieran Huggins »

User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

http://dev.mysql.com/enum may be of interest.
User avatar
serfczar_
Forum Commoner
Posts: 34
Joined: Sun Feb 25, 2007 5:27 pm
Location: USA, Texas
Contact:

Post by serfczar_ »

feyd wrote:http://dev.mysql.com/enum may be of interest.
ahh thx once again.
Post Reply