Knowledge of create and
save text files with Editors
Know which folders to
place web pages on the net or your own computer, ie: HTML or PHP
Knowledge of FTP software
004 - 005 How This Book is
Organized
Part 1: 007-062 Developing a Web
Database Application Using PHP and MySQL
Part 2: 063-110 MySQL Database
Part 3: 111-274 PHP
Part 4: 275-356 Applications
Part 5: 357-372 The Part of Tens
Part 6: 373-418Appendixes
Index: 419
005 Icons Used in This Book
005 - 006 Where to Go from
Here
book is arranged in the
order of things to be done
Part 1 describes how to
get started, including design pieces of your application and how they
interact with each other
create the MySQL database
first
Part 4 describes how to
put the MySQL and PHP pieces together
Part 2 descibes how to
implement your designs into MySQL
Part 3 describes PHP
Chapter 1 - Introduction to
PHP and MySQL
pages 9 - 20
010 What is a Web Database
Application ?
Database
Application
010 defines the different
states of static and dynamic pages
010 PHP can accept and
validate data entered by users, and move data to a database
011 The database
describes MySQL as an
RDBMS (Relational Database Management Systems) well suited for Web
Applications
011 Programs move data in
and out of databases
011 A program connects to
the database and makes different
requests after a user clicks a Submit button from a Web Form.
014 The MySQL Server is the
manager of the database system and
constantly listens for messages directed to it.
015 Communication with the
MySQL Server
we send messages to MySQL
using PHP
the PHP software has
specific statements used to communicate
with the MySQL Server
SQL (Standard Query
Language) is the language that MySQL,
because its an RDBMS, understands
PHP does not understand
SQL, it doesn't need to.
PHP establishes the
connection to the MySQL Server and sends
SQL messages over the connection
the MySQL Server
interprets the SQL message and follows its
instructions
the MySQL sends a return
message, stating its status and what
it did, and any error messages if required
015 PHP, a Data Mover, PHP
is a scripting language designed for
use on the Internet for creating dynamic web pages that interact with
its user
PHP stands for PHP:
Hypertext Preprocessor
the PHP language's syntax
is similar to the syntax of C
you don't need to know the
technical details for connecting and
exchange messages to the database
you tell PHP the name of
the database and where it is and PHP
handles the details
it connects to the
database, passes and receives messages
from the database
016 Advantages of PHP
016 How PHP works
PHP is an embeded
scripting language when used in Web Pages
this means PHP code is
embeded into HTML code
you use HTML tags to
enclose the PHP code you typed into your
HTML page
017 the PHP software runs on
a web server
when PHP is installed, the
Web server is configured to expect
certain file extensions that contain PHP statements
the extension is .php
when a designated file
extension is read by the web server, it
sends the HTML statements "as-is", but PHP statements are processed by
the PHP software before they're sent to the requestor
017 the web server is the
software that delivers Web pages to the world
when you type a URL into a
web browser,
your sending a message
to
the web server at that URL,
asking
it to send you an HTML file
The Web server responds by
sending the requested file to your browser
Your web browser reads the
HTML file and displays the Web page.
You also request the web
server to send you a file when you click a link in a web page
In addition, the web
server processes a file when you click a Web page button that submits a
form
017 when PHP is installed,
the
Web server is configured to expect
certain file extensions that contain PHP statements
the extension is .php
017 when a designated file
extension is read by the web server,
it
sends the HTML statements "as-is", but PHP statements are processed by
the PHP software before they're sent to the requestor
017 when PHP
language statements are processed
only the output is sent by
the web server to the web browser
PHP statements are not
included in the output sent to the browser
so the PHP code is
secure and transparent to the user
017 an example of PHP code
<?php echo "<p>Hello World"; ?>
017 following is the PHP
opening tag
<?php
017 following is the closing
tag
?>
017 the echo statement is a
PHP instruction that tells PHP to output the upcoming text
echo
017 the PHP software
processes the PHP statement and outputs the following
<p>Hello
World
which is a regular HTML
statement, the HTNL code is delivered to the user's browser
the browser interprets the
statement as HTML code and displays a web page with one paragraph
containg the words "Hello World".
the PHP statement is not
delivered to the browser, so the user never sees the PHP code
018 PHP has built-in
functions to use when writing programs that move data in and out of a
MySQL database
019 you use one PHP
statement to connect to your MySQL database
telling where the database
is located, its name, and the password needed to connect to it
you can use another PHP
statement to send an SQL message to MySQL
giving MySQL
instructions for the task you want to accomplish
MySQL returns a status
message that shows whether is successfully performed the task
if there was a problem, it
returns an error message
if your SQL code retrieved
the data that you asked for
PHP stores it in a
temporary location where it is available to you
019 you can use PHP
statements to display the data you retrieved
or you might display a
status message telling the user the data was successfully stored
019 MySQL as an RDBMS, can
store complicated data structures
019 PHP as a scripting
language, can perform complicated manipulations of the data before or
after it is sent or received
Chapter 2 - Setting
Up Your
Work Environment
pages 21 - 36
021 Required Tools
a web server, MySQL, PHP
got the installation
software from xxamp
022 Finding a Place to Work
*** Blake Notes: I have
already secured a web site from GoDaddy that allows me access to all
three tools
plus I can mimic a web
server on the Apple or a Windows PC
to do this I use the
same file structures on my PC and GoDaddy
023 Blake Notes: stresses
the importance of the path and file structure
and owning an FTP utility
or software
023 To use the Web software
tools and build your dynamic Web site, you need to know the following
The location of Web pages
the path for the main
page of your presentation
The default filename
ie: index.html,
default.htm
A MySQL account
access to MySQL
databases is controlled through a system of account names and passwords
author explains MySQL
accounts in detail in Chapter 5
The location of the MySQL
databases
the path for the database
The PHP file extension
.php
031 MySQL is installed
before PHP because the installation or settings for PHP may need the
path of MySQL
032 PHP provides one set of
functions (mysql functions) that communicate with MySQL 4.0 or earlier
and a different set of
functions (mysqli functions) that communicate with MySQL 4.1 or later
mysqli functions are
available only on PHP 5 or later
033 this book uses MySQL 5.0
and mysqli functions
and obviously PHP 5 or
later
033 if you are forced to use
PHP 4, read page 33
033 Testing PHP
Find the directory in
which your PHP programes need to be saved
Create the following file
name in your Web space with the name test.php
this file contains HTML
and PHP code that echo's "This is a PHP line"
Point your browser at the
test.php file you just created or used
you need to include the
name of your web server into the browser address window
here are 2 types of
examples:
on the web use:
www.companyname.com/test.php
on your test PC use:
localhost/test.php
the page is successfully
displayed if the text reads the following
This is an HTML line
This is a PHP line
Check the PHP values for
the settings you need
verify that MySQL
support is On
Change values if necessary
the general settings for
PHP are found in the php.ini
changing PHP settings is
discussed in Appendix B.
035 this page has the HTML
and PHP code for testing, named mysql_up.php
035 bottom of page points
out the following
$host ="host";
$user="mysqlaccount";
$password="mysqlpassword";
036 Change host to the name
of the computer
here are 2 types of
examples:
on the web use:
www.companyname.com
on your test PC use:
localhost
036 Change mysqlaccount and
mysqlpassword to the appropriate values
an account named root is
installed when MySQL is installed
and may or may not have a
password
if no password use the
following code
$password="";
type nothing between
the quotes
036 Point your browser at
mysql_up.php
you should see a table
with long list of variables to it
if error codes are
displayed read page 36
Chapter 3 - Developing a Web
Database Application
pages 37
- 62