Editor’s note: I mentioned in my previous post Display data from MySQL with PHP which I demonstrated how to display the data of a row within a table, now I want to demonstrate how to display all field names (column names) of a table within a MySQL database.
Copy one table’s field records into another table’s field in MySQL database with PHP
Editor’s note: In some cases such as a login system or other company’s stock count system which the records in the MySQL database might need to update very frequently. There might be a need to create another tables to backup monthly of the data to another table in the MySQL database. It is a good idea to copy one table’s field records to another table’s field.
Create a HTML form with PHP for loop and table
Editor’s note: To create a HTML form with just a few text fields and a few HTML form elements is easy, but in a stock control system or price input system for example, there might be a need for many text fields and different HTML form elements repeatedly appear in the HTML form. To type in the codes of all of them will take too much time. Therefore a PHP for loop and a table is good for this task.
Empty a table in MySQL database with HTML form and PHP
Editor’s note: In some cases which the user might need to empty a table in the MySQL database. Instead of deleting every record in the MySQL database, you could run a query “truncate table ‘tablename’” to do the job.
HTML form in a table
Sometimes, you might like to have the HTML looks neat and tidy. A table to hold all of the HTML elements in it would do the job. Here I have created an example to show you a good way to do it.
Create MySQL database table with PHP
Editor’s note: To create a MySQL database table with PHP is very straight forward, all you have to do is to know the query for creating the MySQL database table, and use PHP function mysql_query( ) to run that query. You could also use a HTML form to let the user to input the name of the table.




