The most attractive and best way to display the database records in table format. Below is the simple example to display the records stored in MySQL table. Record Table of Employee
NAME
DEVICE_NAME
NUMBER_OF_UNITS SOLD
TOTAL_PRICE
ROHAN
OVEN
10
70300
SHAYAM
LAPTOP
8
305000
KAMRAN
CAMERA
15
10200
NATHAN
CELL PHONE
20
80000
MARAYA
TELEVISION
5
60000
The above table is a sample example of MySQL table with some records of data.
We need to fetch these data in HTML table to view the data on browser.
Data can be entered into MySQL table by executing SQL INSERT statement with Php mysql_query( ) function. Before this make sure you have created database and table in PhpMyadmin. Below is very simple example to enter data in MySQL using HTML form. Because in live project value are take from HTML form and captured using Php script and this captured value finally inserted in MySQL Table .
Example :- Creating database and table :-
Open PhpMyadmin using username as root and keeping password field blank. Now click on new located on left side. After clicking on window will open asking for database name. Provide the database name as record and click OK. Now new window will open asking table name and number or columns. provide the table name as employee and give 8 numbers of columns and click OK.
Name
Contact
email
Password
Gender
Language
Nationality
Address
Making connectin with PhpMyadmin connection.php
HTML Code (insert.php)
Save this as insert.php
PHP Code(data.php)
Save this as data.php
Description :- For Php code Include_once( ) function is used to inherit the code of connection.php. Strtolower( )function is used to convert the string into lower case. Implode( ) function is used to insert the comma between the string value. Empty( ) function is used to check whether the input field is empty or note. Mysql_query( ) function is used to execute the SQL query.
The functioncheck( ) is used to restrict the user to perform anti programming.