This is my first php program!



Download 6,9 Mb.
Pdf ko'rish
bet61/69
Sana26.02.2022
Hajmi6,9 Mb.
#471647
1   ...   57   58   59   60   61   62   63   64   ...   69
Bog'liq
PHP

Sample Application
Because web database applications are such a mainstay of web development, we’ve
decided to show you a complete sample application in this chapter. This section
develops a self-maintaining business listing service. Companies add their own records
to the database and pick the category or categories by which they want to be indexed.
,ch08.16110 Page 202 Wednesday, March 13, 2002 11:44 AM


This is the Title of the Book, eMatter Edition
Copyright © 2002 O’Reilly & Associates, Inc. All rights reserved.
Sample Application
|
203
Two HTML forms are needed to populate the database tables. One form provides
the site administrator with the means to add category IDs, titles, and descriptions.
The second form, used by the self-registering businesses, collects the business con-
tact information and permits the registrant to associate the listing with one or more
categories. A separate page displays the listings by category on the web page.
Database Tables
There are three tables:
businesses
to collect the address data for each business,
categories
to name and describe each category, and an associative table called
biz_
categories
to relate entries in the other two tables to each other. These tables and
their relationships are shown in Figure 8-3.
Example 8-2 contains a dump of the table schema in MySQL format. Depending on
your database’s features, the schema may have to be altered slightly.
Figure 8-3. Database design for business listing service
Example 8-2. Database schema
# --------------------------------------------------------
#
# Table structure for table 'biz_categories'
#
CREATE TABLE biz_categories (
business_id int(11) NOT NULL,
category_id char(10) NOT NULL,
PRIMARY KEY (business_id, category_id),
KEY business_id (business_id, category_id)
);
# --------------------------------------------------------
#
# Table structure for table 'businesses'
#
CREATE TABLE businesses (
business_id int(11) NOT NULL auto_increment,
name varchar(255) NOT NULL,

Download 6,9 Mb.

Do'stlaringiz bilan baham:
1   ...   57   58   59   60   61   62   63   64   ...   69




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish