UQC103S1 UFCE47-20-1: Systems Development
UQC103S1 UFCE47-20-1: Systems Development
Systems Development
uqc103s/UFCE47-20-1 PHP-mySQL
Who?
Email: [email protected] Web Site www.cems.uwe.ac.uk/~jedawson www.cems.uwe.ac.uk/~jtwebb/uqc103s1/
uqc103s/UFCE47-20-1 PHP-mySQL 2
HELP is at HAND
uqc103s/UFCE47-20-1 PHP-mySQL
What is mySQL? Why PHP and mySQL? How to get and install PHP/mySQL Some SQL
What is mySQL?
more than 4 million active installations Supports a database and allow client/server interactions (storing and retrieving information) On a large system a computer may be solely dedicated to running the DBMS
A DBA (DataBase Administrator) usually manages the database Usually a DBMS is very expensive to buy and/or maintain.
uqc103s/UFCE47-20-1 PHP-mySQL
mySQL has
float,double, enum, date, char, varchar etc.. select, insert, delete, show, "aliases" etc
Functions - e.g. avg(), sum(), max() Security - privilege and password system Scalable - can take billions of rows of data Large character set for internationalisation Tools - admin and other access
uqc103s/UFCE47-20-1 PHP-mySQL 6
MySQL is a key part of LAMP (Linux, Apache, MySQL, PHP / Perl / Python), a fast growing open source enterprise software stack. More and more companies are using LAMP as an alternative to expensive proprietary software stacks because of its lower cost and freedom from lock-in.
http://www.mysql.com/company/index.html
uqc103s/UFCE47-20-1 PHP-mySQL
MySQL
http://www.mysql.com/downloads/index.html
But dont forget (mini -XAMPP) !! Apache/mySQL/PHP/Perl - download and install instructions (the "old" method should work OK)
uqc103s/UFCE47-20-1 PHP-mySQL
Scripts to start and stop are in the minixampp install directory Starting Apache starts an HTTP service on port 80 (default)
http://localhost/ or http://127.0.0.1/
NOTE: XAMPP contains a good admin tool for mySQL http://localhost/phpmyadmin/
uqc103s/UFCE47-20-1 PHP-mySQL
uqc103s/UFCE47-20-1 PHP-mySQL
10
Basic SQL
"sequel" or "ess-cue-el" creating a database creating a table populating a table (inserting data) viewing a table (selecting data and ordering it) changing data (updating data) deleting data
We will consider:
uqc103s/UFCE47-20-1 PHP-mySQL
11
In the simplest case can use mySQL "on the command line" (DOS prompt) the command to use mysql :
install_dir\mysql\bin\mysql get a command prompt and change to the bin folder (or add mysql to your path) make sure mysql service has been started type "mysql" on the command line
uqc103s/UFCE47-20-1 PHP-mySQL
12
uqc103s/UFCE47-20-1 PHP-mySQL
13
uqc103s/UFCE47-20-1 PHP-mySQL
14
uqc103s/UFCE47-20-1 PHP-mySQL
15
uqc103s/UFCE47-20-1 PHP-mySQL
16
Example One:
connect to mySQL select a database define a query execute query present results free resources
Program - mysql1.php
uqc103s/UFCE47-20-1 PHP-mySQL
17
improved formatting order by in select insert new data adding column names LINK: mysql2.php
uqc103s/UFCE47-20-1 PHP-mySQL
18
See search1.html
uqc103s/UFCE47-20-1 PHP-mySQL
19
The PHP
Check input is OK connect to database run query check output process as before See: form1.php
uqc103s/UFCE47-20-1 PHP-mySQL
20
PHP/mySQL tutorial
Learn SQL
uqc103s/UFCE47-20-1 PHP-mySQL
21