Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function getEnumSetValues( $table , $field ){
- // get an array of the allowed values
- // of the enum or set $field of $table
- $query = "SHOW COLUMNS FROM `$table` LIKE '$field'";
- $result = mysql_query( $query ) or die( 'error getting enum field ' . mysql_error() );
- $row = mysql_fetch_array($result);
- if(stripos(".".$row[1],"enum(") > 0) $row[1]=str_replace("enum('","",$row[1]);
- else $row[1]=str_replace("set('","",$row[1]);
- $row[1]=str_replace("','","\n",$row[1]);
- $row[1]=str_replace("')","",$row[1]);
- $ar = split("\n",$row[1]);
- for ($i=0;$i<count($ar);$i++) $arOut[str_replace("''","'",$ar[$i])]=str_replace("''","'",$ar[$i]);
- return $arOut ;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement