Sunday, March 29, 2009

Exercise 8: PHP and MySQL database access

Setup and Create database and table in MySQL

a. Change the root password


b. Login MySQL database system


c. Create database named "mydatabase"


d. Access the created database with command "USE"


e. Create table named "employees"


f. Assign privileges to a user to access the database


Questions in exercise 8
1. Start with a simple table in the database:



2. Create a web page with the following PHP:
Code:


Result:


3. Create a file called add_record.html
Code:


Result:


4. Create a PHP file caleed add_record.php for POST method in web page.
Code:


Result:


5. Show multiple records as webpage.
Code:


Result:


I've found that the result is not as expected, I make changes to the code as follow:
that the field start from the left and the index is start from zero.

Fixed Code:


Result:

No comments:

Post a Comment