PHP/MySQL Database-Driven Websites - PowerPoint PPT Presentation

1 / 14
About This Presentation
Title:

PHP/MySQL Database-Driven Websites

Description:

PHP/MySQL Database-Driven Websites How it Works Tools PHP and MySQL open source; work on both unix and PC platforms Dreamweaver has built in tools for working ... – PowerPoint PPT presentation

Number of Views:424
Avg rating:3.0/5.0
Slides: 15
Provided by: douglas96
Learn more at: https://www.msu.edu
Category:

less

Transcript and Presenter's Notes

Title: PHP/MySQL Database-Driven Websites


1
PHP/MySQLDatabase-Driven Websites
2
How it Works
3
Tools
  • PHP and MySQL open source work on both unix
    and PC platforms
  • Dreamweaver has built in tools for working with
    PHP
  • PHP has built in tools for working with MySQL
  • It is easier to do than it first appears

4
Database Design
  • Make a plan
  • Entity-Relationship Diagrams
  • Use Descriptive Names for Tables
  • Select appropriate data types

5
Build Database (MySQL-Front)
6
The Linklist Table
7
The Linklist Table Dataset
8
Understanding Queries
  • Basic SELECT statement
  • SELECT FROM dbname
  • Basic INSERT statement
  • INSERT INTO dbname (fieldname1, fieldname2)
    VALUES (value1, value2)

9
Writing PHP pages
  • Connect to the Database
  • Perform Queries
  • Get data out from database and turn it into
    variables
  • Write the variables into formatted output

10
Connecting to the Database
  • lt?php
  • Type"MYSQL"
  • HTTP"true"
  • hostname_linklist "matrix.msu.edu"
  • database_linklist "comp"
  • username_linklist "comp"
  • password_linklist "password"
  • linklist mysql_pconnect(hostname_ linklist,
    username_ linklist, password_linklist) or
    die(mysql_error())
  • db mysql_select_db(database_linklist,
    linklist)
  • or die ("Couldn't select database.")
  • ?gt

11
The Link List Example
  • A simple HTML annotated list
  • A database-driven version of the same list
  • Adding records to the database

12
Link List Example Code
  • Ive created plain text files of index.php and
    other files in order to show you the code.
  • index.php
  • input.php
  • processForm.php

13
Link List Example Includes
  • Use include files for html that will be used on
    many pages, and for PHP functions that will be
    re-used on many pages in the site (such as
    connecting to the database)
  • htmlheader.inc
  • htmlfooter.inc

14
Simplify Site Design
  • Use CSS for layouts
  • Use include files for common html elements
  • Use include files for database connection info
    (security issue)
Write a Comment
User Comments (0)
About PowerShow.com