Welcome Guest, Not a member yet? Register   Sign In
How to get enum values
#1

[eluser]Unknown[/eluser]
I've just started using CI but I've ran into a problem handling enum, just wondering if anyone has any suggestions?

I have some fields in the database (mysql) that are set as enum e.g. platform. Is there a function to get the values of these enum ?

I had previously used code like this but I was wonder if CI had a nicer way to do it?

$query="SHOW COLUMNS FROM hds_scripts LIKE 'Platform'";
$result=mysql_query($query);
if(mysql_num_rows($result)>0){
$row=mysql_fetch_row($result);
$options=explode("','",preg_replace("/(enum|set)\('(.+?)'\)/","\\2",$row[1]));
}


Messages In This Thread
How to get enum values - by El Forum - 01-02-2009, 11:25 AM
How to get enum values - by El Forum - 02-18-2009, 11:20 AM
How to get enum values - by El Forum - 05-20-2010, 07:01 PM
How to get enum values - by El Forum - 07-15-2010, 08:27 AM



Theme © iAndrew 2016 - Forum software by © MyBB