Does anyone know how i can list all the NAMES of the fields in a table in my SQL database?
SHOW [FULL] COLUMNS FROM tbl_name [FROM db_name] [LIKE 'pattern']
It will return a record set, one row for each field in the table, with name, field type, Null-Yes/No, Key type, default value and additional attributes.
Way, i never knew about the show function... Been making a few little scripts for my site now! Thanks very much for that.. In one of my scripts im trying to echo all of the tables in my DB into a drop down menu... "SHOW tables"
Id normally do this my something like echo $row['rowname']; but i cant do that here...
How would i go about doing that?
Yes, you can... almost.
Since you don't know the column name - there's only one - you use mysql_fetch_array() as usual, but instead of echo $row['colname'], use echo $row.