PDA

View Full Version : ENUM, An easy way to tell mysql...


nova912
07-16-06, 10:45 AM
Well I have lets say 2 options in enum, 'apple',bubble', can i do something in the query to tell mysql to insert the first or second one into the field by just saying something like this?


$query = 'INSERT INTO table VALUES (1)' // <- Would "bubble" be in that field?


Thanks =)

landing
07-16-06, 11:00 AM
Yep.

ENUM elements have integer keys, if you like.

Example


NULL = NULL
'' = 0
'apple' = 1
'bubble' = 2



Hope that helps

Nico
07-16-06, 02:08 PM
Moving to database...

nova912
07-16-06, 07:42 PM
Moving to database...

Sorry, thought it would be under PHP since i was trying to figure out what string in php what do that in the database, thanks for the move though.

Christian
07-16-06, 08:21 PM
Sorry, thought it would be under PHP since i was trying to figure out what string in php what do that in the database, thanks for the move though.
It's no biggie, don't even worry about it. :)