$catarray[Val]="row[ID]"; $row[ID] = "it works,"; echo ${$catarray[Val]}; // outputs nothing echo $row[ID]; // outputs " it works " PHP: I'm trying to construct variables in a function that dynamically constructs a table populated with MySQL. I need access to the array taken out of the MySQL database. Any ideas why this one doesn'twork? Brandon
Doesn't work because you are searching for a one dimensional variable with the name $row[id], not the 'id' element of the array $row. Why don't you do it like this? It seems variable variables are not necessary for what you are trying to do... $catarray['Val'] = 'ID'; $row['ID'] = 'it works'; echo $row[$catarray['Val']]; PHP: