Create a table dynamically from the mysql query

advertisements

I'm trying to create a page where I input a MYSQL query: SELECT column1,column2 FROM table;, and dynamically create an HTML table with column titles.

EDIT: removed most of my question, just left the question part. I have since created a script that does this and included it as an answer. I hope someone else makes use of it like I do (when I'm too lazy to log into phpmyadmin ... hahaha).


I would try mysql_fetch_assoc which gives back an associative array (map). Then you can use array_keys to get the column names.