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