Building a Database-Driven Web Site
Using PHP and MySQL
by Kevin Yank of SitePoint.com
On the Web today, content is king. After you've mastered HTML and learned
a fe neat tricks in !ava"cri#t and $ynamic HTML, you can #robably build a
#retty im#ressive%looking Web site design. &ut then comes the time to fill
that fancy #age layout ith some real information. Any site that successfully
attracts re#eat visitors has to have fresh and constantly u#dated content. 'n
the orld of traditional site building, that means HTML files%%and lots of 'em.
The #roblem is that, more often than not, the #eo#le #roviding the content
for a site are not the same #eo#le handling its design. Oftentimes, the
content #rovider doesn't even kno HTML. Ho, then, is the content to get
from the #rovider onto the Web site( )ot every com#any can afford to staff
a full%time Webmaster, and most Webmasters have better things to do than
co#ying Word files into HTML tem#lates anyay.
Maintenance of a content%driven site can be a real #ain, too. Many sites
*#erha#s yours(+ feel locked into a dry, outdated design because reriting
those hundreds of HTML files to reflect a ne design ould take forever.
"erver%side includes *""''s+ can hel# alleviate the burden a little, but you
still end u# ith hundreds of files that need to be maintained should you
ish to make a fundamental change to your site.
The solution to these headaches is database%driven site design. &y achieving
com#lete se#aration beteen your site's design and the content you are
looking to #resent, you can ork ith each ithout disturbing the other.
'nstead of riting an HTML file for every #age of your site, you only need to
rite a #age for each kind of information you ant to be able to #resent.
'nstead of endlessly #asting ne content into your tired #age layouts, create
a sim#le content management system that allos the riters to #ost ne
content themselves ithout a lick of HTML,
'n this -.%#art eekly series of articles, ''ll #rovide a hands%on look at
hat's involved in building a database%driven Web site. We'll be using to
ne tools for this/ the 0H0 scri#ting language and the My"1L relational
database. 'f your Web host #rovides 0H02My"1L su##ort, you're in great
sha#e. 'f not, e'll be looking at the set%u# #rocedures under 3ni4 and
Windos, so don't seat it.
These articles are aimed at intermediate or advanced Web designers looking
to make the lea# into server%side #rogramming. 5ou'll be e4#ected to be
comfortable ith HTML, as ''ll be making use of it ithout e4#lanation. A
teensy bit of !ava"cri#t may serve us ell at some #oint, but ''ll be sure to
kee# it sim#le for the uninitiated.
&y the end of this series, you can e4#ect to have a gras# of hat's involved
in setting u# and building a database%driven Web site. 'f you follo along
ith the e4am#les, you'll also learn the basics of 0H0 *a server%side scri#ting
language that allos you to do a lot more than access a database easily+
and "tructured 1uery Language *"1L %% the standard language for
interacting ith relational databases+. Most im#ortantly, you'll come aay
ith everything you need to get started on your very on database%driven
site in no time,
0art -/ 'nstallation
0art 6/ 7etting "tarted ith My"1L
0art 8/ 7etting "tarted ith 0H0
0art 9/ 3sing 0H0 to access a My"1L database
o :hallenge "olution
0arts ;%-. are only available in #rint from "ite0oint.com.
0art ;/ <elational $atabase $esign
0art =/ A :ontent Management "ystem
0art >/ :ontent ?ormatting and "ubmission
0art @/ My"1L Administration
0art A/ Advanced "1L
0art -./ Advanced 0H0