Kirkwood Center for Continuing Education Introduction to PHP and MySQL By Fred McClurg, © Copyright 2015 All Rights Reserved.
Class Project Recipe DB Application Part One: Search & Delete urses/php/slides/recipe01.ppt
Description: The first step of any project is to define the requirements. 1. Provide a web interface to the “cookbookdb” database. 2. Make sure that user can perform CRUD operations on data. 3.Function is usually more important than esthetics. For this project, we pick “fast” and “cheap”. Requirements Definition Good Fast Cheap
Review: An understanding of the database schema is important. 1.To rapidly create database and test data, import “cookbookdb.sql” or create the following database from scratch. Database Requirements
Description: It is pretty hard to beat pencil and paper for rapidly laying out ideas. The original sketch can be refined using “visio”, “dia”, “xfig”, or “OpenOffice/Libre Office”. The form controls can also be captured as images to be pasted and arranged in any graphics application. (see “webParts.html”) Interface Design of Class Project One
TitleRecipeCategoryDelete? JelloMix...Dessert PuddingMix...Dessert KoolaidMix...Beverage... Sketch of interface that handles the “R” and “D” of CRUD: Interface Design: Project One v1 Search Delete Selected
TitleRecipeCategoryDelete JelloMix...Dessert PuddingMix...Dessert KoolaidMix...Beverage... Alternate sketch of GUI interface that handles the “R” and “D” of CRUD: Interface Design: Project One v2 Search Delete
Sketch of GUI interface that handles the “C” and “U” of CRUD: Interface Design: Project Two Mix Cocoa packet with water. Heat. Stir. Hot Cocoa Create Modify Beverage
Discussion: The following procedure represents the tasks we will follow to complete the “search.php” application. 0.Convert from HTML to PHP. 1.Perform the following tasks: a.Initialize variables (Step 0) b.Connect to database (Step 1) c.Use a database (Step 2) d.Close the database connection (Steps 6). General Tasks
2.Perform the following tasks: a.Build the SQL “SELECT” statement (Step 3). b.Execute the SQL statement (Step 4). 3.Build a SQL debug statement. (optional) 4.Build a HTML table with database data: a.Get results from “SELECT” statement (Step 5) b.Display data in dynamic HTML table. General Tasks
5.Remove the static HTML table. 6.Make form changes: a.Make form self-referential (action flexibility). b.Make text field “sticky” (remember previous state). 7.Populate drop-down list with DB values. General Tasks (cont. 2)
8.Add search capabilities for title. 9.Add search for category (optional). 10.Add search for content (optional). 11.Make checkboxes “sticky” (optional). 12.Separate CSS into a separate file. 13.Separate JavaScript into separate file. General Tasks (cont. 3)
Discussion: The items below are the tasks and the procedure we will follow to complete the “delete.php” application. 14.Perform the following tasks: a.Connect and use the database (Steps 1 & 2). b.Build the SQL “DELETE” statement (Step 3). c.Execute the SQL statement (Step 4). d.Obtain results from “DELETE” statement (Step 5). General Tasks (cont. 4)
to be continued... urses/php/slides/recipe02.ppt