Skip to content
Advertisement

How to echo SQL table data in auto created html/PHP table

I have a SQL table named res having some rows and columns. For example:

JavaScript

If someone enter 5 in class.php form then the result should be displayed in automatically generated html/PHP table in descending order of the name. For example:

JavaScript

My class.php code is

JavaScript

My code is fetching all the result matching the criteria but displaying only one (first result) result in table and all other are just only written without space in betweem them… I cannot specify the row number as I don’t know the exact number, all rows are varying depending upon the class or cannot write the same repeated code for echoing all the row because I don’t know how much exactly row is…

What changes should be made in the code to display all the SQL table data in html/PHP generated table ?

Advertisement

Answer

here is the code you need for dynamic columns and records set to display in HTML form

JavaScript

Hope, it helps you buddy. I also modify coding errors, so no worries 🙂

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement