Lab Session 11-B
Lab Session 11-B
Department of CS and SE
Objective
On completion of this lab, students will be able:
PHP MYSQL
To connect MYSQL using PHP go to: http://localhost//phpmyadmin
Enter the username and password Give the database name in the field ‘create new database’.
Click on create button.
Create a new table in the database by giving a table name and number of fields then click on Go
To give field name to the created table,
Write the field name in the ‘field’ column,
Select the data types for each fields, specify the length of each field then click on save to save the
fields and click on Go
When clicked on Go the table field details will be displayed.
To insert values in the field, go to insert and enter the values. Then click on Go.
mysql_query (): Using the database connection identifier, it sends a line of SQL to the MySQL server
to be processed. The results that are returned are stored in the variable $result.
mysql_result (): This is used to display the values of fields from our query. Using $result, we go to the
first row, which is numbered 0, and display the value of the specified fields. mysql_result ($result,
0,"position")): This should be treated as a string and printed.
Display the data from MYSQL database in Web Form.
Web Engineering
Department of CS and SE
Lab Task
1. Write a PHP code to Add employee information insert, delete, and select the data from
database.