Forum Moderators: coopster
mysql_query( "create table myTable ( field not null... etc )" )
and now I want to get a listing of those fields that I added because I want to be able to add and delete fields based on a different table. I tried doing
mysql_query( "describe myTable" )
but all I get is the first row in the table, not all the fields I added. I get in my array (after a mysql_fetch_array call) field, int(11), 0(which is what is stored in the first field) and then I don't get any of the other fields in the table. Anyone know a way for me to get a listing of the fields in a table? Thanks for the help.
sano
The fields will be in separate rows. Uncomment the line below to see the full array in each row:
$rows = mysql_query("DESCRIBE table");
while ($row = mysql_fetch_assoc($rows)) {
// print_r($row);
print $row['Field'] . '<br />';
} Fixed typos
[edited by: coopster at 2:58 pm (utc) on July 8, 2004]