Dynamic Web Pages Ch 4 V1.0


Published on

Published in: Technology, Design
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Dynamic Web Pages Ch 4 V1.0

  1. 1. Chapter 4 Introduction to Databases in PHP
  2. 2. Overview <ul><li>In this chapter you will : </li></ul><ul><ul><li>Create a database connection in dreamweaver. </li></ul></ul><ul><ul><li>Create a recordset. </li></ul></ul><ul><ul><li>Display data from the recordset. </li></ul></ul>
  3. 3. Placing the database on the server <ul><li>We are going to using the database you created in the sql component: newlands. </li></ul><ul><li>Make sure this is database is in the sql directory as shown below. </li></ul>
  4. 4. Exploring the Database <ul><li>Open the database called newland_tours.mdb. </li></ul><ul><li>This is the database that you will be working with. </li></ul><ul><li>The relationships look like this. </li></ul>
  5. 5. Connecting the site to a database <ul><li>Select the + as shown. </li></ul><ul><li>The following sql connection appears, select it. </li></ul><ul><li>This will produce a dialog as shown. </li></ul>Note the database tag has been selected. Complete the dialog as shown. Test the connection and click OK
  6. 6. Check the Connection <ul><li>Click on the + and explore </li></ul><ul><li>the tables etc. </li></ul><ul><li>Note a folder has been added to your site with the connection php file. </li></ul><ul><li>This file is a Dreamweaver configuration. </li></ul>
  7. 7. What’s in the connection file?
  8. 8. Displaying data Using a recordset- 1 <ul><li>Open the index.php file in design view and delete the highlight text. </li></ul>
  9. 9. Displaying data - 2 <ul><li>Select the traveller’s journal image and right click on the h3 tag in the tag selector. </li></ul><ul><li>Select the remove tag from the pop up menu. </li></ul>
  10. 10. Displaying data - 3 <ul><li>Select the + in the bindings as shown. </li></ul><ul><li>Fill in the dialog as shown. </li></ul>Creating a recordset
  11. 11. Displaying data - 4 <ul><li>Drag and drop description as shown. </li></ul><ul><li>Looks like </li></ul><ul><li>You can also view Data using the live data as shown </li></ul>
  12. 12. Lab 4 -1 <ul><li>Overview </li></ul><ul><ul><li>Create sql connection for the lab database </li></ul></ul><ul><ul><li>Create a dreamweaver connection </li></ul></ul><ul><ul><li>Create a recordset for the equipment. </li></ul></ul><ul><ul><li>Create a dynamic table using the equipment recordset. </li></ul></ul>
  13. 13. Lab 4 equpment.php Design Dynamic table
  14. 14. Lab 4 equipment.php live
  15. 15. Lab 4 -2 <ul><li>Connect the site to the database </li></ul><ul><ul><li>call it dwda. </li></ul></ul><ul><li>Open equipment.php page. </li></ul><ul><li>Create a recordset </li></ul><ul><ul><li>Call it rs_equip </li></ul></ul><ul><ul><li>Select all field except EquipID </li></ul></ul><ul><ul><li>Sort on EquipType field in Ascending order. </li></ul></ul><ul><li>Test the recordset. </li></ul>
  16. 16. Lab 4- recordset
  17. 17. Lab 4 -3 <ul><li>Select the HTML table containing equipment and delete the table. </li></ul><ul><li>On the Application tab on the Insert bar, click Dynamic Data and choose Dynamic Table. </li></ul><ul><li>Choose all records from the rs_equip recordset and give a border of 1 and a cellpadding of 3. </li></ul><ul><li>Click OK. </li></ul><ul><li>Change the headings to be more descriptive and bold them. </li></ul><ul><li>Save the page and preview it. </li></ul>