1 mexican restaurant prepared by sandy nichols november 21, 2006
TRANSCRIPT
1
Mexican Restaurant
Prepared by Sandy NicholsNovember 21, 2006
2
Table of Contents
Executive Summary 3Site Map 4Database Structure 5Menu Page
Flowchart 6Pseudo Code 7
Admin PageFlowchart 8Pseudo Code 9
Edit RecordsFlowchart
10Pseudo Code
11Delete Records
Flow Chart12
Pseudo Code13
3
Executive SummaryEl Azteca Mexican Restaurant needs a website that showcases their menu, provides directions, and gives a general presence on the web.
This will be achieved by storing the menu in a MySQL database and having PHP dynamically write to the Menu page. The restaurant also needs a way to periodically post specials themselves. Advertised specials are by way of coupons circulated throughout the community. By building a photo gallery, they will be able to frequently upload an image of the coupon directly to their Home page. This approach preserves the restaurant’s current marketing strategy while providing another means of coupon distribution through a web presence.
The Definitions page will define what is in popular Mexican dishes. If a person does not know what a Chalupa is, they can go to the page and read “flat tortilla with beans sprinkled with cheese and topped with guacamole salad.” Definitions will be taken from the current printed menu. If restaurant is willing to have the food photographed, this page could have an accompanying photo with the definitions.
The about page will be a static page with some light history about the company, coupled with photos of beautiful people dining and drinking on the outdoor patio and listening to the Mariachi band. This page will be designed to give an overall feel of the atmosphere. This page may include pictures of long-term servers willing to be photographed.
Currently the proposed site is five pages, but should be considered scaleable if future needs arise. Additions could be a feature on the many brands of tequilla sold at the bar or a feature on Mexican specialty drinks. Another enhancement could be the ability to take online secured orders for carry-out. Flash components could add another level of interactivity, like make your own virtual tacos game.Current Coupon
4
Specials Coupons
Dynamic Dynamic Static Static
History Patio pics Staff pics
Site Map
Static
DatabasePhoto Gallery
DirectionsContact
Definitions of Mexican
food
5
Database Structure
M E N U
P H O T O G A L L E R Y (for coupons)
6
Visit Menu page
Connect toMySQL
Select db to work with
Query DB by Category
Store in variable
Store # ofrecords in
variable
Is # records>0 ?
Fetch recordEcho
Record
“No records”stop
stop
Flowchart for Menu Page
7
Visit Menu page
Connect toMySQL
Select db to work with
Query DB by Category
Store in variable
Store # ofrecords in
variable
Is # records>0 ?
Fetch recordEcho
Record
“No records”stop
stop
Pseudo Code for Menu Page
• OPEN DB ElAzteca• READ DB• SET results to a variable• SET # of results to variable• DOWHILE # >0• READ results from variable• WRITE results to page• CLOSE file
8
Flowchart for Admin Page
Visit Admin url
Successful
login
NO
YES
AdminPage
Add/Edit/DeleteAdd/Edit/Delete
Photo Gallery
Stop
Add/Edit/DeleteMenu
Database
9
Pseudo Code for Admin Page
• DO login verificationVisit Admin url
Successful
login
NO
YES
AdminPage
Add/Edit/DeleteAdd/Edit/Delete
Photo Gallery
Stop
Add/Edit/DeleteMenu
Database
10
Flowchart for Editing Recordsstart
Is record id set?“Record does
not exist”
stop
NO YES
Has formBeen submitted?
Showform
stop
NO YES
Update RecordDB Where
id =$_GET[‘id’]
Errors?NO YES
“Query Error”Output SQL
& Mysql_error()
stop
stop
StartSession
RedirectTo admin
page
showForm()
Connect to DB
Select DB
Query DBFor record
Output formWith data
In elements
EndshowForm()
Store successMessage inSession Var
11
Pseudo Code for Editing Recordsstart
Is record id set?“Record does
not exist”
stop
NO YES
Has formBeen submitted?
Showform
stop
NO YES
Update RecordDB Where
id =$_GET[‘id’]
Errors?NO YES
“Query Error”Output SQL
& Mysql_error()
stop
stop
StartSession
RedirectTo admin
page
showForm()
Connect to DB
Select DB
Query DBFor record
Output formWith data
In elements
EndshowForm()
Store successMessage inSession Var
• OPEN record id• READ record id• IF id not set THEN WRITE error• IF id set THEN continue• READ record id• IF id not submitted THEN show form• IF id submitted THEN WRITE DB• END-IF• IF errors THEN WRITE error• IF no errors THEN WRITE success• END-IF• OPEN Admin page• CLOSE
12
Flowchart for Deleting Records start
Is record id set?
Delete Var Set?
NO YES
NO YES
NO
YES
Query DB For Record
“Are you sure?”Show Record
Delete?
RedirectTo admin
page
stop
Delete RecordFrom DB Table
Where id=$_GET[‘id’]
Errors?NO YES
“Query Error”Output SQL
& Mysql_error()
stop
stop
StartSession
RedirectTo admin
page
Store successMessage inSession Var
“No such record”
stop
13
Pseudo Code for Deleting Records start
Is record id set?
Delete Var Set?
NO YES
NO YES
NO
YES
Query DB For Record
“Are you sure?”Show Record
Delete?
RedirectTo admin
page
stop
Delete RecordFrom DB Table
Where id=$_GET[‘id’]
Errors?NO YES
“Query Error”Output SQL
& Mysql_error()
stop
stop
StartSession
RedirectTo admin
page
Store successMessage inSession Var
“No such record”
stop
• READ record id• IF id not set THEN WRITE error• IF id set THEN continue• END-IF•IF delete not confirmed, THEN confirm•IF delete confirmed THEN delete• END-IF• IF errors THEN WRITE error• IF no errors THEN WRITE success• OPEN Admin page• END-IF• CLOSE
14