SQL return data type

zester

New Member
Messages
23
Reaction score
0
Points
0
Hi all

In my table I have a feild called race the data type is SET, in the SET is 'Huuman';'HighElf'; Dworf" and so on.

how do I get SQL to return the SET not the data fold in the feild, so I can put it in a arrey.

Zest
 

jspcodes

New Member
Messages
60
Reaction score
0
Points
0
$str= $row['fieldname'];
$array=(explode(',', $str));
for($i=0;$i<count($array);$i++)
{
echo $array[$i]."<br>";
}

Sorry if i am wrong.I cannot understand your problem exactly
 
Last edited:

zester

New Member
Messages
23
Reaction score
0
Points
0
I do not want the data held in the feild, I want to get the SET of possable values for the feild.

zest
 

woiwky

New Member
Messages
390
Reaction score
0
Points
0
Try using:

PHP:
$sql = "DESCRIBE Table_Name_Here Field_Name_Here";
$values = mysql_fetch_assoc(mysql_query($sql));
$values = explode(',', substr(str_replace('\'', '', $values['Type']), 4, -1));
This should set $values to an array containing each of the possible set values.
 
Top