Categories > TinyButStrong general >

Automatic generation of dbase coloumnnames as HTML tableheaders

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Maarten
Date: 2004-09-27
Time: 16:00

Automatic generation of dbase coloumnnames as HTML tableheaders

I want to use the columnnames of a table (Mysql dbase) to create HTML tabelheader names (<TH>..colunmname...</TH>) automatically.

Does anyone know how to do this in TBS?

Thanks in advance!!!
By: peirgwnael
Date: 2004-09-27
Time: 17:29

Re: Automatic generation of dbase coloumnnames as HTML tableheaders

You can put your query in an array and use the fonction [block.key;block=th] to print the columnname.
If you indcate the columnname in the query in the order you want, i think it works...
Without guarantee...

there's surely a better solution.
By: Skrol29
Date: 2004-09-28
Time: 02:29

Re: Automatic generation of dbase coloumnnames as HTML tableheaders

Another idea is to first open a query with mysql_query() and get the resource of the result.
Then with mysql_num_fields() and mysql_field_name() , you can build an array that contains all columns names.
You merge your table with this array to extend the number of columns of your table.
Then you merge the rows of the tables with the resource of the result.