This is my first php program!


Businesses Business ID Name Address City Telephone URL Biz_Categories



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

Businesses
Business ID
Name
Address
City
Telephone
URL
Biz_Categories
Business ID
Category ID
Categories
Category ID
Title
Description
1,n
1,n
,ch08.16110 Page 203 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.
204
|
Chapter 8: Databases
Database Connection
We’ve designed these pages to work with a MySQL, PostgreSQL, or Oracle 8
i
back-
end. The only visible sign of this in the PHP code is that we use
commit( )
after every
update. We’ve abstracted the database-specific stuff to a
db_login.php
library, shown
in Example 8-3, which selects an appropriate DSN for MySQL, PostgreSQL, or Oracle.
address varchar(255) NOT NULL,
city varchar(128) NOT NULL,
telephone varchar(64) NOT NULL,
url varchar(255),
PRIMARY KEY (business_id),
UNIQUE business_id (business_id),
KEY business_id_2 (business_id)
);
# --------------------------------------------------------
#
# Table structure for table 'categories'
#
CREATE TABLE categories (
category_id varchar(10) NOT NULL,
title varchar(128) NOT NULL,
description varchar(255) NOT NULL,
PRIMARY KEY (category_id),
UNIQUE category_id (category_id),
KEY category_id_2 (category_id)
);
Example 8-3. Database connection abstraction script (db_login.php)
require_once('DB.php');
// database connection setup section
$username = 'user';
$password = 'seekrit';
$hostspec = 'localhost';
$database = 'phpbook';
// select one of these three values for $phptype
// $phptype = 'pgsql';
// $phptype = 'oci8';
$phptype = 'mysql';
// check for Oracle 8 - data source name syntax is different
if ($phptype != 'oci8'){
Example 8-2. Database schema (continued)
,ch08.16110 Page 204 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.

Download 6,9 Mb.

Do'stlaringiz bilan baham:
1   ...   58   59   60   61   62   63   64   65   ...   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