from a MySQL DB i want to get a multidimensional array that i can loop
through
either key =field name value = array of ENUM options
or array[x][0] =field name, array[x][1]= ENUM options and increment x
inside loop
$q=mysql_query("SHOW FIELDS FROM table" ) or die ("Query failed");
while ($row = mysql_fetch_array($q))
{
//from http://uk.php.net/mysql_fetch_field
echo 'field is '.$row['Field'] . ' type is ' . $row['Type'];
if (ereg('enum.(.*).', $row['Field'], $match))
{
$opts = explode(',', $match[1]);
foreach ($opts as $item)
{$finalResult[] = substr($item, 1, strlen($item)-2);}
}
$array=array ($row['Field'] =>$finalResult[]);
}
gives Fatal error :Cannot use [] for reading in .......
a similar error message when i try a multidimentional array
array[$x][0]=$row['Field']
array[$x][1]=$finalResult[]
anyone know the answer ( or a better way of doing it )