Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 409
  • Last Modified:

any way to generate a dynamic html tables?

i am seeking some example on how to generate a completely dynamic
html tables from its table header, table body, table footer everything
is dynamic and read from database.

Any method of way and language are welcome, i know there is a
way to do it with for loop, but i not sure how to sort the data i get
into correct order regarding to it header and content.

3 Solutions
I'm going to go out on a limb here (twohawks said quivering in fear of the onslaught from the masters..)

...what you propose sounds a lot like what most any forum software does, i.e., dynamically generating tables and populating them based on whatever the combined query 'right now' is, pulling the data from teh database and using the php to build the table (or tablesets) on the fly.

If I were going to muse over soem code for doing this, aside from my searchbar (wherein I would put php mysql dynamic tables, which I am sure you are doing)... I would download and install FluxBB, and open source mysql/php forum software which is simplicity itself, very well thought out, and very powerful.  I have used it for some years now, and it has taught me a lot.

This obviously is not "an answer", but I find your question most intriguing, and that was my first brainwave - just thought I'd risk tossing it out there.

Oh.. fluxbb is open source, and a wonderful coding community.
boon86Author Commented:
i'm not looking for forum software, im looking for something that can populate
a table by row and column with data using from database. so that it can count
how many column used and how many rows need dynamically.
Yes, sorry I fell short in my clarity, ...I was not implying using the software itself, I was indicating it is ==using techniques== with php, mysql, and dynamic table structure building and populating based on live query that you can observe and study (after installing it) for gleaning the methods employed relevant to what you are describing and asking about.
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Dave BaldwinFixer of ProblemsCommented:
Virtually every CMS like Wordpress, Joomla, and the others operate essentially as you are asking about to create the entire web page.  You will need a server side programming language and a database that you can access using it.  The two most common combinations are PHP/MySQL and ASP.NET/Microsoft SQL Server.  There are many other possibilities though.

There are many examples of code to do this and I suggest you download and try some to see how they work.  For your own project, you need a plan.  Part of that plan is how to identify the elements you want in the database.  That means how to tell where a piece goes, in the main table, in the header, or in the footer.
You do the sort with the ORDER BY clause of the SELECT. Then process the rows from the query with a for or while loop.

What kind of database do you have, and what scripting language do you have available on the server to generate the page?
boon86Author Commented:
i think i have come out something with drop down and generate the table row using custom query
Glad you are finding a leg up on this, boon. Thanks for the points.

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now