Difference between revisions of "PHPEX04"

From mi-linux
Jump to navigationJump to search
 
(16 intermediate revisions by 2 users not shown)
Line 5: Line 5:
 
*Using the [[PhpMyAdmin|phpMyAdmin]] administration page, create a simple table (people, products, films, bands, etc.) For this example I have created a Films table:
 
*Using the [[PhpMyAdmin|phpMyAdmin]] administration page, create a simple table (people, products, films, bands, etc.) For this example I have created a Films table:
  
[[IMAGE:Mysql-table-example01.gif]]
+
https://mi-linux.wlv.ac.uk/wiki-images/PHPEX04-01.png
  
 
*Still using the [[PhpMyAdmin|phpMyAdmin]] administration page, insert some data in your table, for example:
 
*Still using the [[PhpMyAdmin|phpMyAdmin]] administration page, insert some data in your table, for example:
  
[[IMAGE:Mysql-table-example02.gif]]
+
https://mi-linux.wlv.ac.uk/wiki-images/PHPEX04-02.png
  
*Finally, create a single webpage that connects to your database, retreive the data from the table above, and displays it in an unordered list:
+
*Finally, create a single webpage that connects to your database, retreive the film names from the table above, and displays them in an unordered list (<nowiki><UL></nowiki>):
 +
**Alien
 +
**Aliens
 +
**Alien 3
 +
**Predator
 +
**Seven
 +
**Sin City
  
*Alien
+
Important: make sure that your page's HTML is compliant!
*Aliens
+
 
*Alien 3
+
*Want to try something a little more difficult? Try displaying the name and duration of all films in a 2-column HTML table, as follow:
*Predator
+
 
*Seven
+
{| border="3" cellpadding=3 cellspacing=3
*Sin City
+
|Alien||110 mins
 +
|-
 +
|Aliens||130 mins
 +
|-
 +
|Alien 3||100 mins
 +
|-
 +
|Predator||100 mins
 +
|-
 +
|Seven||100 mins
 +
|-
 +
|Sin City||100 mins
 +
|}
 +
 
 +
'''Important: you should commit your mini-task code to your Git project.'''
 +
 
 +
= Ready to move on? =
 +
 
 +
All done? Let's [[PHP112|move on]]!

Latest revision as of 12:07, 20 September 2023

Main Page >> Web Application Development >> Workbook >> Mini-task 04

This week you have learnt to retrieve data from an existing database/table. But let's work with YOUR database:

  • Register for a Mysql database if you haven't already done so.
  • Using the phpMyAdmin administration page, create a simple table (people, products, films, bands, etc.) For this example I have created a Films table:

PHPEX04-01.png

  • Still using the phpMyAdmin administration page, insert some data in your table, for example:

PHPEX04-02.png

  • Finally, create a single webpage that connects to your database, retreive the film names from the table above, and displays them in an unordered list (<UL>):
    • Alien
    • Aliens
    • Alien 3
    • Predator
    • Seven
    • Sin City

Important: make sure that your page's HTML is compliant!

  • Want to try something a little more difficult? Try displaying the name and duration of all films in a 2-column HTML table, as follow:
Alien 110 mins
Aliens 130 mins
Alien 3 100 mins
Predator 100 mins
Seven 100 mins
Sin City 100 mins

Important: you should commit your mini-task code to your Git project.

Ready to move on?

All done? Let's move on!