PHP & MySQL Database -...
Transcript of PHP & MySQL Database -...
![Page 1: PHP & MySQL Database - carme.cs.trinity.educarme.cs.trinity.edu/thicks/3343/Lectures/PHP-MySQL-Slides.pdf · PHP's mysqli Extension –1 The mysqli extension, or as it is sometimes](https://reader031.fdocuments.in/reader031/viewer/2022022719/5c64a93d09d3f2b26e8b81e9/html5/thumbnails/1.jpg)
Dr. Tom HicksComputer Science Department
PHP & MySQL Database
Database SystemsCSCI-3343
1
![Page 2: PHP & MySQL Database - carme.cs.trinity.educarme.cs.trinity.edu/thicks/3343/Lectures/PHP-MySQL-Slides.pdf · PHP's mysqli Extension –1 The mysqli extension, or as it is sometimes](https://reader031.fdocuments.in/reader031/viewer/2022022719/5c64a93d09d3f2b26e8b81e9/html5/thumbnails/2.jpg)
WWW Organization
It Is A Good Idea To
Create A Folder For
Each Web Page
Place Most Items, On
Page, In That Folder!2
![Page 3: PHP & MySQL Database - carme.cs.trinity.educarme.cs.trinity.edu/thicks/3343/Lectures/PHP-MySQL-Slides.pdf · PHP's mysqli Extension –1 The mysqli extension, or as it is sometimes](https://reader031.fdocuments.in/reader031/viewer/2022022719/5c64a93d09d3f2b26e8b81e9/html5/thumbnails/3.jpg)
WWW SetUp
3
![Page 4: PHP & MySQL Database - carme.cs.trinity.educarme.cs.trinity.edu/thicks/3343/Lectures/PHP-MySQL-Slides.pdf · PHP's mysqli Extension –1 The mysqli extension, or as it is sometimes](https://reader031.fdocuments.in/reader031/viewer/2022022719/5c64a93d09d3f2b26e8b81e9/html5/thumbnails/4.jpg)
Create Folders
Quadratic, FirstPrime, & RandomNo
4
![Page 5: PHP & MySQL Database - carme.cs.trinity.educarme.cs.trinity.edu/thicks/3343/Lectures/PHP-MySQL-Slides.pdf · PHP's mysqli Extension –1 The mysqli extension, or as it is sometimes](https://reader031.fdocuments.in/reader031/viewer/2022022719/5c64a93d09d3f2b26e8b81e9/html5/thumbnails/5.jpg)
Drag .php Pages Into Their Proper Folders
If You Do So Inside Expression Web, The Links Will Adjust
Within Site!
(You Will Not Have To Change Main-Menu.php)
5
![Page 6: PHP & MySQL Database - carme.cs.trinity.educarme.cs.trinity.edu/thicks/3343/Lectures/PHP-MySQL-Slides.pdf · PHP's mysqli Extension –1 The mysqli extension, or as it is sometimes](https://reader031.fdocuments.in/reader031/viewer/2022022719/5c64a93d09d3f2b26e8b81e9/html5/thumbnails/6.jpg)
Add The Link Below To The Bottom Of
Quadratic.php
RandomNo.php
FirstPrime.php
<p><A href="../Main-Menu.php"> Return To Main Menu </A>
6
Add The Link Below To The Bottom Of Each
Of Your Other Pages As Well!
![Page 7: PHP & MySQL Database - carme.cs.trinity.educarme.cs.trinity.edu/thicks/3343/Lectures/PHP-MySQL-Slides.pdf · PHP's mysqli Extension –1 The mysqli extension, or as it is sometimes](https://reader031.fdocuments.in/reader031/viewer/2022022719/5c64a93d09d3f2b26e8b81e9/html5/thumbnails/7.jpg)
Database
Export
With A Script!7
![Page 8: PHP & MySQL Database - carme.cs.trinity.educarme.cs.trinity.edu/thicks/3343/Lectures/PHP-MySQL-Slides.pdf · PHP's mysqli Extension –1 The mysqli extension, or as it is sometimes](https://reader031.fdocuments.in/reader031/viewer/2022022719/5c64a93d09d3f2b26e8b81e9/html5/thumbnails/8.jpg)
MySQLNative Import - Export
8
![Page 9: PHP & MySQL Database - carme.cs.trinity.educarme.cs.trinity.edu/thicks/3343/Lectures/PHP-MySQL-Slides.pdf · PHP's mysqli Extension –1 The mysqli extension, or as it is sometimes](https://reader031.fdocuments.in/reader031/viewer/2022022719/5c64a93d09d3f2b26e8b81e9/html5/thumbnails/9.jpg)
Use mysqldump!
cd C:\Program Files\MySQL\MySQL Server 8.0\bin
mysqldump -ptrinity -uroot stanford > c:\temp\stanford2.sql
Command Line Export Database
9
![Page 10: PHP & MySQL Database - carme.cs.trinity.educarme.cs.trinity.edu/thicks/3343/Lectures/PHP-MySQL-Slides.pdf · PHP's mysqli Extension –1 The mysqli extension, or as it is sometimes](https://reader031.fdocuments.in/reader031/viewer/2022022719/5c64a93d09d3f2b26e8b81e9/html5/thumbnails/10.jpg)
Database
Export
With MySQL
Workbench - Done10
![Page 11: PHP & MySQL Database - carme.cs.trinity.educarme.cs.trinity.edu/thicks/3343/Lectures/PHP-MySQL-Slides.pdf · PHP's mysqli Extension –1 The mysqli extension, or as it is sometimes](https://reader031.fdocuments.in/reader031/viewer/2022022719/5c64a93d09d3f2b26e8b81e9/html5/thumbnails/11.jpg)
Database
Import
With A Script!11
![Page 12: PHP & MySQL Database - carme.cs.trinity.educarme.cs.trinity.edu/thicks/3343/Lectures/PHP-MySQL-Slides.pdf · PHP's mysqli Extension –1 The mysqli extension, or as it is sometimes](https://reader031.fdocuments.in/reader031/viewer/2022022719/5c64a93d09d3f2b26e8b81e9/html5/thumbnails/12.jpg)
Use mysql!
Create database Stanford2 must be created before the import!
cd C:\Program Files\MySQL\MySQL Server 8.0\bin
mysql -ptrinity -uroot stanford2 < c:\temp\stanford2.sql
Command Line Import Database
12
![Page 13: PHP & MySQL Database - carme.cs.trinity.educarme.cs.trinity.edu/thicks/3343/Lectures/PHP-MySQL-Slides.pdf · PHP's mysqli Extension –1 The mysqli extension, or as it is sometimes](https://reader031.fdocuments.in/reader031/viewer/2022022719/5c64a93d09d3f2b26e8b81e9/html5/thumbnails/13.jpg)
Database
Import
With MySQL
Workbench - Done13
![Page 14: PHP & MySQL Database - carme.cs.trinity.educarme.cs.trinity.edu/thicks/3343/Lectures/PHP-MySQL-Slides.pdf · PHP's mysqli Extension –1 The mysqli extension, or as it is sometimes](https://reader031.fdocuments.in/reader031/viewer/2022022719/5c64a93d09d3f2b26e8b81e9/html5/thumbnails/14.jpg)
phpinfo()
14
![Page 15: PHP & MySQL Database - carme.cs.trinity.educarme.cs.trinity.edu/thicks/3343/Lectures/PHP-MySQL-Slides.pdf · PHP's mysqli Extension –1 The mysqli extension, or as it is sometimes](https://reader031.fdocuments.in/reader031/viewer/2022022719/5c64a93d09d3f2b26e8b81e9/html5/thumbnails/15.jpg)
Create Page Student-Display.php
Student-Display.php Confirm that the PHP is working!
<?php
phpinfo();
?>
15
![Page 16: PHP & MySQL Database - carme.cs.trinity.educarme.cs.trinity.edu/thicks/3343/Lectures/PHP-MySQL-Slides.pdf · PHP's mysqli Extension –1 The mysqli extension, or as it is sometimes](https://reader031.fdocuments.in/reader031/viewer/2022022719/5c64a93d09d3f2b26e8b81e9/html5/thumbnails/16.jpg)
Connect To
MySQL
Database
16
![Page 17: PHP & MySQL Database - carme.cs.trinity.educarme.cs.trinity.edu/thicks/3343/Lectures/PHP-MySQL-Slides.pdf · PHP's mysqli Extension –1 The mysqli extension, or as it is sometimes](https://reader031.fdocuments.in/reader031/viewer/2022022719/5c64a93d09d3f2b26e8b81e9/html5/thumbnails/17.jpg)
Create Folder
Student-Display
17
![Page 18: PHP & MySQL Database - carme.cs.trinity.educarme.cs.trinity.edu/thicks/3343/Lectures/PHP-MySQL-Slides.pdf · PHP's mysqli Extension –1 The mysqli extension, or as it is sometimes](https://reader031.fdocuments.in/reader031/viewer/2022022719/5c64a93d09d3f2b26e8b81e9/html5/thumbnails/18.jpg)
Create Page
Use Expression Web To Create Page
Student-Display.php
18
![Page 19: PHP & MySQL Database - carme.cs.trinity.educarme.cs.trinity.edu/thicks/3343/Lectures/PHP-MySQL-Slides.pdf · PHP's mysqli Extension –1 The mysqli extension, or as it is sometimes](https://reader031.fdocuments.in/reader031/viewer/2022022719/5c64a93d09d3f2b26e8b81e9/html5/thumbnails/19.jpg)
Modify Menu Page
Link Student-Display.php
19
![Page 20: PHP & MySQL Database - carme.cs.trinity.educarme.cs.trinity.edu/thicks/3343/Lectures/PHP-MySQL-Slides.pdf · PHP's mysqli Extension –1 The mysqli extension, or as it is sometimes](https://reader031.fdocuments.in/reader031/viewer/2022022719/5c64a93d09d3f2b26e8b81e9/html5/thumbnails/20.jpg)
Modify Page Student-Display.php
Add The Code:
<?PHP/*================================================================ Connect To MySQL Database ================================================================*/$server ="localhost"; $username="root";$password="trinity";$database="libraryth1";
$con=mysqli_connect($server, $username, $password, $database);?>
We Changed The Original PHP.ini To Make This Work!
20
![Page 21: PHP & MySQL Database - carme.cs.trinity.educarme.cs.trinity.edu/thicks/3343/Lectures/PHP-MySQL-Slides.pdf · PHP's mysqli Extension –1 The mysqli extension, or as it is sometimes](https://reader031.fdocuments.in/reader031/viewer/2022022719/5c64a93d09d3f2b26e8b81e9/html5/thumbnails/21.jpg)
Create Page Student-Display.php
This is the same as the previous page!
<?php/*================================================================ Connect To MySQL Database ================================================================*/$conn = new mysqli();$conn->connect("localhost","root","trinity","libraryth");
?>
We Changed The Original PHP.ini To Make This Work!
21
![Page 22: PHP & MySQL Database - carme.cs.trinity.educarme.cs.trinity.edu/thicks/3343/Lectures/PHP-MySQL-Slides.pdf · PHP's mysqli Extension –1 The mysqli extension, or as it is sometimes](https://reader031.fdocuments.in/reader031/viewer/2022022719/5c64a93d09d3f2b26e8b81e9/html5/thumbnails/22.jpg)
Modify php.ini -3-
Edit C:\Program Files\PHP\php.ini
In order to keep PHP lean and mean, many of the optional extensions
are turned off.
We must turn on the MySQL extensions.
22
We Changed The Original PHP.ini To Make This Work!
![Page 23: PHP & MySQL Database - carme.cs.trinity.educarme.cs.trinity.edu/thicks/3343/Lectures/PHP-MySQL-Slides.pdf · PHP's mysqli Extension –1 The mysqli extension, or as it is sometimes](https://reader031.fdocuments.in/reader031/viewer/2022022719/5c64a93d09d3f2b26e8b81e9/html5/thumbnails/23.jpg)
Modify php.ini -4A-
We must often tell the system where we are storing these optional
(MySQL) extensions.
23
We Changed The Original PHP.ini To Make This Work!
![Page 24: PHP & MySQL Database - carme.cs.trinity.educarme.cs.trinity.edu/thicks/3343/Lectures/PHP-MySQL-Slides.pdf · PHP's mysqli Extension –1 The mysqli extension, or as it is sometimes](https://reader031.fdocuments.in/reader031/viewer/2022022719/5c64a93d09d3f2b26e8b81e9/html5/thumbnails/24.jpg)
Modify php.ini -4B-
Edit C:\Program Files\PHP\php.ini
We must often tell the system where we are storing these optional
(MySQL) extensions.
24
We Changed The Original PHP.ini To Make This Work!
![Page 25: PHP & MySQL Database - carme.cs.trinity.educarme.cs.trinity.edu/thicks/3343/Lectures/PHP-MySQL-Slides.pdf · PHP's mysqli Extension –1 The mysqli extension, or as it is sometimes](https://reader031.fdocuments.in/reader031/viewer/2022022719/5c64a93d09d3f2b26e8b81e9/html5/thumbnails/25.jpg)
Database
Query
25
![Page 26: PHP & MySQL Database - carme.cs.trinity.educarme.cs.trinity.edu/thicks/3343/Lectures/PHP-MySQL-Slides.pdf · PHP's mysqli Extension –1 The mysqli extension, or as it is sometimes](https://reader031.fdocuments.in/reader031/viewer/2022022719/5c64a93d09d3f2b26e8b81e9/html5/thumbnails/26.jpg)
Modify Page Student-Display.php -1-
Change the connection portion to the following:
<?PHP/*================================================================ Connect To MySQL Database ================================================================*/$server ="localhost"; $username="StanfordUser";$password="trinity"; //Use Your Password $database="stanford";
$con=mysqli_connect($server, $username, $password, $database);?>
26
![Page 27: PHP & MySQL Database - carme.cs.trinity.educarme.cs.trinity.edu/thicks/3343/Lectures/PHP-MySQL-Slides.pdf · PHP's mysqli Extension –1 The mysqli extension, or as it is sometimes](https://reader031.fdocuments.in/reader031/viewer/2022022719/5c64a93d09d3f2b26e8b81e9/html5/thumbnails/27.jpg)
Stanford User Privileges On Stanford DB
Stanford Cannot Change DB.
<?PHP/*================================================================ Connect To MySQL Database ================================================================*/$server ="localhost"; $username="StanfordUser";$password="trinity"; //Use Your Password $database="stanford";
$con=mysqli_connect($server, $username, $password, $database);?>
27
![Page 28: PHP & MySQL Database - carme.cs.trinity.educarme.cs.trinity.edu/thicks/3343/Lectures/PHP-MySQL-Slides.pdf · PHP's mysqli Extension –1 The mysqli extension, or as it is sometimes](https://reader031.fdocuments.in/reader031/viewer/2022022719/5c64a93d09d3f2b26e8b81e9/html5/thumbnails/28.jpg)
Try Bad Server localhost1
<?PHP/*================================================================ Connect To MySQL Database ================================================================*/$server ="localhost1"; $username="StanfordUser";$password="trinity"; //Use Your Password $database="stanford";
$con=mysqli_connect($server, $username, $password, $database);?>
28
![Page 29: PHP & MySQL Database - carme.cs.trinity.educarme.cs.trinity.edu/thicks/3343/Lectures/PHP-MySQL-Slides.pdf · PHP's mysqli Extension –1 The mysqli extension, or as it is sometimes](https://reader031.fdocuments.in/reader031/viewer/2022022719/5c64a93d09d3f2b26e8b81e9/html5/thumbnails/29.jpg)
Try Bad UserName StanfordUser1
<?PHP/*================================================================ Connect To MySQL Database ================================================================*/$server ="localhost"; $username="StanfordUser1";$password="trinity"; //Use Your Password $database="stanford";
$con=mysqli_connect($server, $username, $password, $database);?>
29
![Page 30: PHP & MySQL Database - carme.cs.trinity.educarme.cs.trinity.edu/thicks/3343/Lectures/PHP-MySQL-Slides.pdf · PHP's mysqli Extension –1 The mysqli extension, or as it is sometimes](https://reader031.fdocuments.in/reader031/viewer/2022022719/5c64a93d09d3f2b26e8b81e9/html5/thumbnails/30.jpg)
Try Bad Password trinity1
<?PHP/*================================================================ Connect To MySQL Database ================================================================*/$server ="localhost"; $username="StanfordUser1";$password="trinity1"; //Use Your Password $database="stanford";
$con=mysqli_connect($server, $username, $password, $database);?>
30
![Page 31: PHP & MySQL Database - carme.cs.trinity.educarme.cs.trinity.edu/thicks/3343/Lectures/PHP-MySQL-Slides.pdf · PHP's mysqli Extension –1 The mysqli extension, or as it is sometimes](https://reader031.fdocuments.in/reader031/viewer/2022022719/5c64a93d09d3f2b26e8b81e9/html5/thumbnails/31.jpg)
Try Bad Database stanford1
<?PHP/*================================================================ Connect To MySQL Database ================================================================*/$server ="localhost"; $username="StanfordUser1";$password="trinity"; //Use Your Password$database="stanford1";
$con=mysqli_connect($server, $username, $password, $database);?>
31
![Page 32: PHP & MySQL Database - carme.cs.trinity.educarme.cs.trinity.edu/thicks/3343/Lectures/PHP-MySQL-Slides.pdf · PHP's mysqli Extension –1 The mysqli extension, or as it is sometimes](https://reader031.fdocuments.in/reader031/viewer/2022022719/5c64a93d09d3f2b26e8b81e9/html5/thumbnails/32.jpg)
Blank Is Good!-1-
Connection Established!
<?PHP/*================================================================ Connect To MySQL Database ================================================================*/$server ="localhost"; $username="StanfordUser";$password="trinity"; //Use Your Password$database="stanford";
$con=mysqli_connect($server, $username, $password, $database);?>
32
![Page 33: PHP & MySQL Database - carme.cs.trinity.educarme.cs.trinity.edu/thicks/3343/Lectures/PHP-MySQL-Slides.pdf · PHP's mysqli Extension –1 The mysqli extension, or as it is sometimes](https://reader031.fdocuments.in/reader031/viewer/2022022719/5c64a93d09d3f2b26e8b81e9/html5/thumbnails/33.jpg)
Modify Page Student-Display.php -2-
Add the Query : Use Your Name!
. . ./*================================================================ Query ================================================================*/$query = "SELECT * FROM Users";$recSet = $conn->query($query);
echo "<CENTER><H1> Display Students </H1></CENTER>";echo "<CENTER><H2> Written By Dr. Tom Hicks </H2></CENTER><HR>";
?>
33
![Page 34: PHP & MySQL Database - carme.cs.trinity.educarme.cs.trinity.edu/thicks/3343/Lectures/PHP-MySQL-Slides.pdf · PHP's mysqli Extension –1 The mysqli extension, or as it is sometimes](https://reader031.fdocuments.in/reader031/viewer/2022022719/5c64a93d09d3f2b26e8b81e9/html5/thumbnails/34.jpg)
Modify Page Student-Display.php -3-
Cycle Through The Record Set Loop: print the data
. . . echo "<CENTER><H1> Display Students</H1></CENTER>";echo "<CENTER><H2> Written By Dr. Tom Hicks </H2></CENTER><HR>";
echo "<pre><P>";/*================================================================ Loop Through Records In Record Set ================================================================*/while(list($sID, $sName, $GPA) = $recSet->fetch_row())
printf("<strong>%3d %-15s %4.2f </strong> <BR>", $sID, $sName, $GPA);
echo "</h2></pre>";?>
34
<p><A href="../Main-Menu.php"> Return To Main Menu </A>
![Page 35: PHP & MySQL Database - carme.cs.trinity.educarme.cs.trinity.edu/thicks/3343/Lectures/PHP-MySQL-Slides.pdf · PHP's mysqli Extension –1 The mysqli extension, or as it is sometimes](https://reader031.fdocuments.in/reader031/viewer/2022022719/5c64a93d09d3f2b26e8b81e9/html5/thumbnails/35.jpg)
Modify Page Student-Display.php -3-
There are several ways to connect.
There are a number of ways to walk through the records.
35
![Page 36: PHP & MySQL Database - carme.cs.trinity.educarme.cs.trinity.edu/thicks/3343/Lectures/PHP-MySQL-Slides.pdf · PHP's mysqli Extension –1 The mysqli extension, or as it is sometimes](https://reader031.fdocuments.in/reader031/viewer/2022022719/5c64a93d09d3f2b26e8b81e9/html5/thumbnails/36.jpg)
Inefficient!
Why Read All Of Data If Only Going To Display Part?
36
![Page 37: PHP & MySQL Database - carme.cs.trinity.educarme.cs.trinity.edu/thicks/3343/Lectures/PHP-MySQL-Slides.pdf · PHP's mysqli Extension –1 The mysqli extension, or as it is sometimes](https://reader031.fdocuments.in/reader031/viewer/2022022719/5c64a93d09d3f2b26e8b81e9/html5/thumbnails/37.jpg)
More Efficient!
Reduce The Transfer Of Data
37
![Page 38: PHP & MySQL Database - carme.cs.trinity.educarme.cs.trinity.edu/thicks/3343/Lectures/PHP-MySQL-Slides.pdf · PHP's mysqli Extension –1 The mysqli extension, or as it is sometimes](https://reader031.fdocuments.in/reader031/viewer/2022022719/5c64a93d09d3f2b26e8b81e9/html5/thumbnails/38.jpg)
Modify Page Student-Display.php -4-
There are other ways to Generate the same output.
/*================================================================ Loop Through Records In Record Set ================================================================*/while($Rec = $recSet->fetch_row())
printf("<B>%3d %-15s %4.2f </B> <BR>", $Rec[0], $Rec[1], $Rec[2]);
echo "</h2></pre>";
38
![Page 39: PHP & MySQL Database - carme.cs.trinity.educarme.cs.trinity.edu/thicks/3343/Lectures/PHP-MySQL-Slides.pdf · PHP's mysqli Extension –1 The mysqli extension, or as it is sometimes](https://reader031.fdocuments.in/reader031/viewer/2022022719/5c64a93d09d3f2b26e8b81e9/html5/thumbnails/39.jpg)
About
PHP & MySQLSpecial Thanks To PHP.net For Some Of
The Following Documentation
39
![Page 40: PHP & MySQL Database - carme.cs.trinity.educarme.cs.trinity.edu/thicks/3343/Lectures/PHP-MySQL-Slides.pdf · PHP's mysqli Extension –1 The mysqli extension, or as it is sometimes](https://reader031.fdocuments.in/reader031/viewer/2022022719/5c64a93d09d3f2b26e8b81e9/html5/thumbnails/40.jpg)
API – Application Programming Interface
An Application Programming Interface, or API, defines the classes,
methods, functions and variables that your application will need to call
in order to carry out its desired task.
In the case of PHP applications that need to communicate with
databases the necessary APIs are usually exposed via PHP
extensions.
APIs can be Procedural or Object-Oriented.
With a procedural API you call functions to carry out tasks
With the object-oriented API you instantiate classes and then call
methods on the resulting objects.
The Object-Priented API is usually the Preferred Interface, as it
is more modern and leads to better organized code.
When writing PHP applications that need to connect to the MySQL
server there are several API options available.
40
![Page 41: PHP & MySQL Database - carme.cs.trinity.educarme.cs.trinity.edu/thicks/3343/Lectures/PHP-MySQL-Slides.pdf · PHP's mysqli Extension –1 The mysqli extension, or as it is sometimes](https://reader031.fdocuments.in/reader031/viewer/2022022719/5c64a93d09d3f2b26e8b81e9/html5/thumbnails/41.jpg)
MySQL Connector
In the MySQL documentation, the term Connector refers to a piece
of software that allows your application to connect to the MySQL
database server.
MySQL provides connectors for a variety of languages, including
PHP.
41
![Page 42: PHP & MySQL Database - carme.cs.trinity.educarme.cs.trinity.edu/thicks/3343/Lectures/PHP-MySQL-Slides.pdf · PHP's mysqli Extension –1 The mysqli extension, or as it is sometimes](https://reader031.fdocuments.in/reader031/viewer/2022022719/5c64a93d09d3f2b26e8b81e9/html5/thumbnails/42.jpg)
PHP Extension
In the PHP documentation you will come across another term -
Extension. The PHP code consists of a core, with optional extensions
to the core functionality.
PHP's MySQL-related extensions, such as the mysqli extension,
and the mysql extension, are implemented using the PHP
extension framework.
An extension typically exposes an API to the PHP programmer, to
allow its facilities to be used programmatically. However, some
extensions which use the PHP extension framework do not expose an
API to the PHP programmer.
The PDO MySQL driver extension, for example, does not expose an
API to the PHP programmer, but provides an interface to the PDO
layer above it.
The terms API and extension should not be taken to mean the same
thing, as an extension may not necessarily expose an API to the
programmer.
42
![Page 43: PHP & MySQL Database - carme.cs.trinity.educarme.cs.trinity.edu/thicks/3343/Lectures/PHP-MySQL-Slides.pdf · PHP's mysqli Extension –1 The mysqli extension, or as it is sometimes](https://reader031.fdocuments.in/reader031/viewer/2022022719/5c64a93d09d3f2b26e8b81e9/html5/thumbnails/43.jpg)
Main PHP API Offerings For MySQL
There are three main API options when considering connecting to a
MySQL database server:
PHP's MySQL Extension
PHP's mysqli Extension
PHP Data Objects (PDO)
43
![Page 44: PHP & MySQL Database - carme.cs.trinity.educarme.cs.trinity.edu/thicks/3343/Lectures/PHP-MySQL-Slides.pdf · PHP's mysqli Extension –1 The mysqli extension, or as it is sometimes](https://reader031.fdocuments.in/reader031/viewer/2022022719/5c64a93d09d3f2b26e8b81e9/html5/thumbnails/44.jpg)
PHP's MySQL Extension
This is the Original Extension designed to allow you to develop PHP
applications that interact with a MySQL database.
The mysql extension provides a procedural interface and is intended
for use only with MySQL versions older than 4.1.3.
This extension can be used with versions of MySQL 4.1.3 or newer,
but not all of the latest MySQL server features will be available.
This Is Old Technology!:
The majority of references on the Internet demonstrate how to use
the MySQL Extension.
If you are using MySQL versions 4.1.3 or later it is strongly
recommended that you use the mysqli extension instead. YES
The MySQL Extension is being phased out!
The mysql extension source code is located in the PHP extension
directory ext/mysql.
44
![Page 45: PHP & MySQL Database - carme.cs.trinity.educarme.cs.trinity.edu/thicks/3343/Lectures/PHP-MySQL-Slides.pdf · PHP's mysqli Extension –1 The mysqli extension, or as it is sometimes](https://reader031.fdocuments.in/reader031/viewer/2022022719/5c64a93d09d3f2b26e8b81e9/html5/thumbnails/45.jpg)
PHP's mysqli Extension – 1
The mysqli extension, or as it is sometimes known, the MySQL
improved extension, was developed to take advantage of new
features found in MySQL systems versions 4.1.3 and newer.
The mysqli extension is included with PHP versions 5 and later.
The mysqli extension has a number of benefits, the key
enhancements over the mysql extension being:
Object-oriented interface
Support for Prepared Statements
Support for Multiple Statements
Support for Transactions
Enhanced debugging capabilities
Embedded server support
45
![Page 46: PHP & MySQL Database - carme.cs.trinity.educarme.cs.trinity.edu/thicks/3343/Lectures/PHP-MySQL-Slides.pdf · PHP's mysqli Extension –1 The mysqli extension, or as it is sometimes](https://reader031.fdocuments.in/reader031/viewer/2022022719/5c64a93d09d3f2b26e8b81e9/html5/thumbnails/46.jpg)
PHP's mysqli Extension – 2
If you are using MySQL versions 4.1.3 or later it is strongly
recommended that you use this extension.
As well as the Object-Oriented Interface the extension also provides a
Procedural Interface.
The mysqli extension is built using the PHP extension framework, its
source code is located in the directory ext/mysqli.
46
![Page 47: PHP & MySQL Database - carme.cs.trinity.educarme.cs.trinity.edu/thicks/3343/Lectures/PHP-MySQL-Slides.pdf · PHP's mysqli Extension –1 The mysqli extension, or as it is sometimes](https://reader031.fdocuments.in/reader031/viewer/2022022719/5c64a93d09d3f2b26e8b81e9/html5/thumbnails/47.jpg)
PHP Data Objects (PDO)
PHP Data Objects, or PDO, is a database abstraction layer
specifically for PHP applications. PDO provides a consistent API for
your PHP application regardless of the type of database server your
application will connect to.
In theory, if you are using the PDO API, you could switch the
database server you used, from say Firebird to MySQL, and only
need to make minor changes to your PHP code.
While PDO has its advantages, such as a clean, simple, portable API,
its main disadvantage is that it doesn't allow you to use all of the
advanced features that are available in the latest versions of MySQL
server.
For example, PDO does not allow you to use MySQL's support for
Multiple Statements.
PDO is implemented using the PHP extension framework, its source
code is located in the directory ext/pdo.
47
![Page 51: PHP & MySQL Database - carme.cs.trinity.educarme.cs.trinity.edu/thicks/3343/Lectures/PHP-MySQL-Slides.pdf · PHP's mysqli Extension –1 The mysqli extension, or as it is sometimes](https://reader031.fdocuments.in/reader031/viewer/2022022719/5c64a93d09d3f2b26e8b81e9/html5/thumbnails/51.jpg)
Database
Applications
Have Many Connections
51
![Page 52: PHP & MySQL Database - carme.cs.trinity.educarme.cs.trinity.edu/thicks/3343/Lectures/PHP-MySQL-Slides.pdf · PHP's mysqli Extension –1 The mysqli extension, or as it is sometimes](https://reader031.fdocuments.in/reader031/viewer/2022022719/5c64a93d09d3f2b26e8b81e9/html5/thumbnails/52.jpg)
Create Folder
C:\InetPub\wwwroot\Secure-Connect
52
![Page 53: PHP & MySQL Database - carme.cs.trinity.educarme.cs.trinity.edu/thicks/3343/Lectures/PHP-MySQL-Slides.pdf · PHP's mysqli Extension –1 The mysqli extension, or as it is sometimes](https://reader031.fdocuments.in/reader031/viewer/2022022719/5c64a93d09d3f2b26e8b81e9/html5/thumbnails/53.jpg)
Create Page Connection.php -1-
It is often the case that there might be hundreds of web pages that
access a single database. Passwords change. The database host can
change.
We would like an easy way to be able to change the password only
one time.
Create page Connection.asp – include it hundreds of times! When the
time comes to make a change, do it once. Save In Folder Secure-
Connect!
<?PHP/*================================================================ Connect To MySQL Database ================================================================*/$server ="localhost"; $username="StanfordUser";$password="trinity"; //Use Your Password$database="stanford";
$con=mysqli_connect($server, $username, $password, $database);?>
53
![Page 54: PHP & MySQL Database - carme.cs.trinity.educarme.cs.trinity.edu/thicks/3343/Lectures/PHP-MySQL-Slides.pdf · PHP's mysqli Extension –1 The mysqli extension, or as it is sometimes](https://reader031.fdocuments.in/reader031/viewer/2022022719/5c64a93d09d3f2b26e8b81e9/html5/thumbnails/54.jpg)
Save a Copy of Student-Display.php in
Folder
C:\InetPub\wwwroot\StudentoDisplay
Call It
TestSecureConnection.php
54
![Page 55: PHP & MySQL Database - carme.cs.trinity.educarme.cs.trinity.edu/thicks/3343/Lectures/PHP-MySQL-Slides.pdf · PHP's mysqli Extension –1 The mysqli extension, or as it is sometimes](https://reader031.fdocuments.in/reader031/viewer/2022022719/5c64a93d09d3f2b26e8b81e9/html5/thumbnails/55.jpg)
Modify Page TestSecureConnection.php<?PHP/*================================================================ Connect To MySQL Database ================================================================*/
include_once "../../Secure-Connect/Connection.php";
/*================================================================ Query 2 ================================================================*/$query2 = "SELECT sID, sName, GPA FROM Student";$recSet2 = $con->query($query);
echo "<CENTER><H1> Display Students</H1></CENTER>";echo "<CENTER><H2> Written By Dr. Tom Hicks </H2></CENTER><HR>";
echo "<pre><P>";
/*================================================================ Loop Through Records In Record Set ================================================================*/while($Rec2 = $recSet->fetch_row())
printf("<B>%3d %-15s %4.2f </B> <BR>",$Rec2[0], $Rec2[1], $Rec2[2]);
echo "</h2></pre>";?> 55
![Page 56: PHP & MySQL Database - carme.cs.trinity.educarme.cs.trinity.edu/thicks/3343/Lectures/PHP-MySQL-Slides.pdf · PHP's mysqli Extension –1 The mysqli extension, or as it is sometimes](https://reader031.fdocuments.in/reader031/viewer/2022022719/5c64a93d09d3f2b26e8b81e9/html5/thumbnails/56.jpg)
Link TestSecureConnection.php
56
![Page 57: PHP & MySQL Database - carme.cs.trinity.educarme.cs.trinity.edu/thicks/3343/Lectures/PHP-MySQL-Slides.pdf · PHP's mysqli Extension –1 The mysqli extension, or as it is sometimes](https://reader031.fdocuments.in/reader031/viewer/2022022719/5c64a93d09d3f2b26e8b81e9/html5/thumbnails/57.jpg)
Connection Page Works!
57
![Page 58: PHP & MySQL Database - carme.cs.trinity.educarme.cs.trinity.edu/thicks/3343/Lectures/PHP-MySQL-Slides.pdf · PHP's mysqli Extension –1 The mysqli extension, or as it is sometimes](https://reader031.fdocuments.in/reader031/viewer/2022022719/5c64a93d09d3f2b26e8b81e9/html5/thumbnails/58.jpg)
Some PHP
Pages
Have Many Queries
58
![Page 59: PHP & MySQL Database - carme.cs.trinity.educarme.cs.trinity.edu/thicks/3343/Lectures/PHP-MySQL-Slides.pdf · PHP's mysqli Extension –1 The mysqli extension, or as it is sometimes](https://reader031.fdocuments.in/reader031/viewer/2022022719/5c64a93d09d3f2b26e8b81e9/html5/thumbnails/59.jpg)
Save a Copy of TestSecureConnection.php
in Folder
C:\InetPub\wwwroot\StudentoDisplay
59
Call It
TestMultipleQueries.php
![Page 60: PHP & MySQL Database - carme.cs.trinity.educarme.cs.trinity.edu/thicks/3343/Lectures/PHP-MySQL-Slides.pdf · PHP's mysqli Extension –1 The mysqli extension, or as it is sometimes](https://reader031.fdocuments.in/reader031/viewer/2022022719/5c64a93d09d3f2b26e8b81e9/html5/thumbnails/60.jpg)
Make The Link To Main-Menu.php
60
Goal
![Page 61: PHP & MySQL Database - carme.cs.trinity.educarme.cs.trinity.edu/thicks/3343/Lectures/PHP-MySQL-Slides.pdf · PHP's mysqli Extension –1 The mysqli extension, or as it is sometimes](https://reader031.fdocuments.in/reader031/viewer/2022022719/5c64a93d09d3f2b26e8b81e9/html5/thumbnails/61.jpg)
Change/*================================================================ Query ================================================================*/$query = "SELECT sID, sName, GPA FROM Student";$recSet = $con->query($query);
61
To
/*================================================================ Query 2 ================================================================*/
$query2 = "SELECT sID, sName, GPA FROM Student";$recSet2 = $con->query($query2);
![Page 62: PHP & MySQL Database - carme.cs.trinity.educarme.cs.trinity.edu/thicks/3343/Lectures/PHP-MySQL-Slides.pdf · PHP's mysqli Extension –1 The mysqli extension, or as it is sometimes](https://reader031.fdocuments.in/reader031/viewer/2022022719/5c64a93d09d3f2b26e8b81e9/html5/thumbnails/62.jpg)
Change/*================================================================ Loop Through Records In Record Set ================================================================*/while($Rec = $recSet-> fetch_row())
printf("<B>%3d %-15s %4.2f </B> <BR>", $Rec[0], $Rec[1], $Rec[2]);
62
To
/*================================================================ Loop Through Records In Record Set ================================================================*/
while($Rec1 = $recSet2-> fetch_row()) printf("<B>%3d %-15s %4.2f </B> <BR>",
$Rec1[0], $Rec1[1], $Rec1[2]);
![Page 63: PHP & MySQL Database - carme.cs.trinity.educarme.cs.trinity.edu/thicks/3343/Lectures/PHP-MySQL-Slides.pdf · PHP's mysqli Extension –1 The mysqli extension, or as it is sometimes](https://reader031.fdocuments.in/reader031/viewer/2022022719/5c64a93d09d3f2b26e8b81e9/html5/thumbnails/63.jpg)
Add A Print Statementecho "<pre><p>";/*=============================================================== Loop Through Records In Record Set ================================================================*/
$query1 = "SELECT COUNT(*) AS NoStudents FROM Student";$recSet1 = $con->query($query1);$Rec = $recSet1->fetch_row();
63
echo "<pre><p>";
print "No Students = " . $Rec[0] . "<p><hr>";
/*=============================================================== Loop Through Records In Record Set ================================================================*/
$query1 = "SELECT COUNT(*) AS NoStudents FROM Student";$recSet1 = $con->query($query1);$Rec = $recSet1->fetch_row();
![Page 64: PHP & MySQL Database - carme.cs.trinity.educarme.cs.trinity.edu/thicks/3343/Lectures/PHP-MySQL-Slides.pdf · PHP's mysqli Extension –1 The mysqli extension, or as it is sometimes](https://reader031.fdocuments.in/reader031/viewer/2022022719/5c64a93d09d3f2b26e8b81e9/html5/thumbnails/64.jpg)
One Connection - Multiple Queries!
64
![Page 65: PHP & MySQL Database - carme.cs.trinity.educarme.cs.trinity.edu/thicks/3343/Lectures/PHP-MySQL-Slides.pdf · PHP's mysqli Extension –1 The mysqli extension, or as it is sometimes](https://reader031.fdocuments.in/reader031/viewer/2022022719/5c64a93d09d3f2b26e8b81e9/html5/thumbnails/65.jpg)
WWW GUI
Can Help You Provide
Nicely Formatted Output
65
![Page 66: PHP & MySQL Database - carme.cs.trinity.educarme.cs.trinity.edu/thicks/3343/Lectures/PHP-MySQL-Slides.pdf · PHP's mysqli Extension –1 The mysqli extension, or as it is sometimes](https://reader031.fdocuments.in/reader031/viewer/2022022719/5c64a93d09d3f2b26e8b81e9/html5/thumbnails/66.jpg)
Flyspeed Query
66
![Page 67: PHP & MySQL Database - carme.cs.trinity.educarme.cs.trinity.edu/thicks/3343/Lectures/PHP-MySQL-Slides.pdf · PHP's mysqli Extension –1 The mysqli extension, or as it is sometimes](https://reader031.fdocuments.in/reader031/viewer/2022022719/5c64a93d09d3f2b26e8b81e9/html5/thumbnails/67.jpg)
Results Of Query
67
We Would Like To Do On A Nicely
Formatted Web Page!
![Page 68: PHP & MySQL Database - carme.cs.trinity.educarme.cs.trinity.edu/thicks/3343/Lectures/PHP-MySQL-Slides.pdf · PHP's mysqli Extension –1 The mysqli extension, or as it is sometimes](https://reader031.fdocuments.in/reader031/viewer/2022022719/5c64a93d09d3f2b26e8b81e9/html5/thumbnails/68.jpg)
Goal!
68
![Page 69: PHP & MySQL Database - carme.cs.trinity.educarme.cs.trinity.edu/thicks/3343/Lectures/PHP-MySQL-Slides.pdf · PHP's mysqli Extension –1 The mysqli extension, or as it is sometimes](https://reader031.fdocuments.in/reader031/viewer/2022022719/5c64a93d09d3f2b26e8b81e9/html5/thumbnails/69.jpg)
Inside Folder C:\inetpub\wwwroot\PHP
Create Folder
Stanford-Student-Apply
69
![Page 70: PHP & MySQL Database - carme.cs.trinity.educarme.cs.trinity.edu/thicks/3343/Lectures/PHP-MySQL-Slides.pdf · PHP's mysqli Extension –1 The mysqli extension, or as it is sometimes](https://reader031.fdocuments.in/reader031/viewer/2022022719/5c64a93d09d3f2b26e8b81e9/html5/thumbnails/70.jpg)
Inside Folder Stanford-Student-Apply
Use Expression Web To Create Stanford-
Student-Apply.php
70
![Page 71: PHP & MySQL Database - carme.cs.trinity.educarme.cs.trinity.edu/thicks/3343/Lectures/PHP-MySQL-Slides.pdf · PHP's mysqli Extension –1 The mysqli extension, or as it is sometimes](https://reader031.fdocuments.in/reader031/viewer/2022022719/5c64a93d09d3f2b26e8b81e9/html5/thumbnails/71.jpg)
Link The New Page
71
![Page 72: PHP & MySQL Database - carme.cs.trinity.educarme.cs.trinity.edu/thicks/3343/Lectures/PHP-MySQL-Slides.pdf · PHP's mysqli Extension –1 The mysqli extension, or as it is sometimes](https://reader031.fdocuments.in/reader031/viewer/2022022719/5c64a93d09d3f2b26e8b81e9/html5/thumbnails/72.jpg)
Configure Your Page Properties
72
![Page 73: PHP & MySQL Database - carme.cs.trinity.educarme.cs.trinity.edu/thicks/3343/Lectures/PHP-MySQL-Slides.pdf · PHP's mysqli Extension –1 The mysqli extension, or as it is sometimes](https://reader031.fdocuments.in/reader031/viewer/2022022719/5c64a93d09d3f2b26e8b81e9/html5/thumbnails/73.jpg)
Configure Your Page Properties
73
![Page 74: PHP & MySQL Database - carme.cs.trinity.educarme.cs.trinity.edu/thicks/3343/Lectures/PHP-MySQL-Slides.pdf · PHP's mysqli Extension –1 The mysqli extension, or as it is sometimes](https://reader031.fdocuments.in/reader031/viewer/2022022719/5c64a93d09d3f2b26e8b81e9/html5/thumbnails/74.jpg)
Configure Your Page Properties
74
![Page 75: PHP & MySQL Database - carme.cs.trinity.educarme.cs.trinity.edu/thicks/3343/Lectures/PHP-MySQL-Slides.pdf · PHP's mysqli Extension –1 The mysqli extension, or as it is sometimes](https://reader031.fdocuments.in/reader031/viewer/2022022719/5c64a93d09d3f2b26e8b81e9/html5/thumbnails/75.jpg)
Create The Following With Arial FontUse Your Name
75
![Page 76: PHP & MySQL Database - carme.cs.trinity.educarme.cs.trinity.edu/thicks/3343/Lectures/PHP-MySQL-Slides.pdf · PHP's mysqli Extension –1 The mysqli extension, or as it is sometimes](https://reader031.fdocuments.in/reader031/viewer/2022022719/5c64a93d09d3f2b26e8b81e9/html5/thumbnails/76.jpg)
Move Your Cursor Below The Horizontal
Rule:
Insert A New Table On Your Page
76
![Page 77: PHP & MySQL Database - carme.cs.trinity.educarme.cs.trinity.edu/thicks/3343/Lectures/PHP-MySQL-Slides.pdf · PHP's mysqli Extension –1 The mysqli extension, or as it is sometimes](https://reader031.fdocuments.in/reader031/viewer/2022022719/5c64a93d09d3f2b26e8b81e9/html5/thumbnails/77.jpg)
Configure Your Table As Shown Below
77
![Page 78: PHP & MySQL Database - carme.cs.trinity.educarme.cs.trinity.edu/thicks/3343/Lectures/PHP-MySQL-Slides.pdf · PHP's mysqli Extension –1 The mysqli extension, or as it is sometimes](https://reader031.fdocuments.in/reader031/viewer/2022022719/5c64a93d09d3f2b26e8b81e9/html5/thumbnails/78.jpg)
You Should Now Have The Start Of Your
Table
78
![Page 79: PHP & MySQL Database - carme.cs.trinity.educarme.cs.trinity.edu/thicks/3343/Lectures/PHP-MySQL-Slides.pdf · PHP's mysqli Extension –1 The mysqli extension, or as it is sometimes](https://reader031.fdocuments.in/reader031/viewer/2022022719/5c64a93d09d3f2b26e8b81e9/html5/thumbnails/79.jpg)
Add The The Following Titles To The First
Row Use Arial Font
79
![Page 80: PHP & MySQL Database - carme.cs.trinity.educarme.cs.trinity.edu/thicks/3343/Lectures/PHP-MySQL-Slides.pdf · PHP's mysqli Extension –1 The mysqli extension, or as it is sometimes](https://reader031.fdocuments.in/reader031/viewer/2022022719/5c64a93d09d3f2b26e8b81e9/html5/thumbnails/80.jpg)
Select All Of The Cells In Row 1
Right-Mouse Click On One
Select Cell Properties
80
![Page 81: PHP & MySQL Database - carme.cs.trinity.educarme.cs.trinity.edu/thicks/3343/Lectures/PHP-MySQL-Slides.pdf · PHP's mysqli Extension –1 The mysqli extension, or as it is sometimes](https://reader031.fdocuments.in/reader031/viewer/2022022719/5c64a93d09d3f2b26e8b81e9/html5/thumbnails/81.jpg)
Configure The Cells:
81
Dark Blue
![Page 82: PHP & MySQL Database - carme.cs.trinity.educarme.cs.trinity.edu/thicks/3343/Lectures/PHP-MySQL-Slides.pdf · PHP's mysqli Extension –1 The mysqli extension, or as it is sometimes](https://reader031.fdocuments.in/reader031/viewer/2022022719/5c64a93d09d3f2b26e8b81e9/html5/thumbnails/82.jpg)
Change The Font Color In The First Row To
White
82
![Page 83: PHP & MySQL Database - carme.cs.trinity.educarme.cs.trinity.edu/thicks/3343/Lectures/PHP-MySQL-Slides.pdf · PHP's mysqli Extension –1 The mysqli extension, or as it is sometimes](https://reader031.fdocuments.in/reader031/viewer/2022022719/5c64a93d09d3f2b26e8b81e9/html5/thumbnails/83.jpg)
Insert XX Into Each Cell In Row 2
83
![Page 84: PHP & MySQL Database - carme.cs.trinity.educarme.cs.trinity.edu/thicks/3343/Lectures/PHP-MySQL-Slides.pdf · PHP's mysqli Extension –1 The mysqli extension, or as it is sometimes](https://reader031.fdocuments.in/reader031/viewer/2022022719/5c64a93d09d3f2b26e8b81e9/html5/thumbnails/84.jpg)
Select All The Cells In Row 2 &
Configure As Shown Below
84
Dark Blue
![Page 85: PHP & MySQL Database - carme.cs.trinity.educarme.cs.trinity.edu/thicks/3343/Lectures/PHP-MySQL-Slides.pdf · PHP's mysqli Extension –1 The mysqli extension, or as it is sometimes](https://reader031.fdocuments.in/reader031/viewer/2022022719/5c64a93d09d3f2b26e8b81e9/html5/thumbnails/85.jpg)
Add The Connection Before The Table
85
![Page 86: PHP & MySQL Database - carme.cs.trinity.educarme.cs.trinity.edu/thicks/3343/Lectures/PHP-MySQL-Slides.pdf · PHP's mysqli Extension –1 The mysqli extension, or as it is sometimes](https://reader031.fdocuments.in/reader031/viewer/2022022719/5c64a93d09d3f2b26e8b81e9/html5/thumbnails/86.jpg)
Add Your Query
86
![Page 87: PHP & MySQL Database - carme.cs.trinity.educarme.cs.trinity.edu/thicks/3343/Lectures/PHP-MySQL-Slides.pdf · PHP's mysqli Extension –1 The mysqli extension, or as it is sometimes](https://reader031.fdocuments.in/reader031/viewer/2022022719/5c64a93d09d3f2b26e8b81e9/html5/thumbnails/87.jpg)
Add The Connection Before The Table
87
![Page 88: PHP & MySQL Database - carme.cs.trinity.educarme.cs.trinity.edu/thicks/3343/Lectures/PHP-MySQL-Slides.pdf · PHP's mysqli Extension –1 The mysqli extension, or as it is sometimes](https://reader031.fdocuments.in/reader031/viewer/2022022719/5c64a93d09d3f2b26e8b81e9/html5/thumbnails/88.jpg)
We Need To Cycle Through Our Records
Each Cycke Will Create One Of These Rows
88
![Page 89: PHP & MySQL Database - carme.cs.trinity.educarme.cs.trinity.edu/thicks/3343/Lectures/PHP-MySQL-Slides.pdf · PHP's mysqli Extension –1 The mysqli extension, or as it is sometimes](https://reader031.fdocuments.in/reader031/viewer/2022022719/5c64a93d09d3f2b26e8b81e9/html5/thumbnails/89.jpg)
Add Your Loop
89
![Page 90: PHP & MySQL Database - carme.cs.trinity.educarme.cs.trinity.edu/thicks/3343/Lectures/PHP-MySQL-Slides.pdf · PHP's mysqli Extension –1 The mysqli extension, or as it is sometimes](https://reader031.fdocuments.in/reader031/viewer/2022022719/5c64a93d09d3f2b26e8b81e9/html5/thumbnails/90.jpg)
Making Progress
90
![Page 91: PHP & MySQL Database - carme.cs.trinity.educarme.cs.trinity.edu/thicks/3343/Lectures/PHP-MySQL-Slides.pdf · PHP's mysqli Extension –1 The mysqli extension, or as it is sometimes](https://reader031.fdocuments.in/reader031/viewer/2022022719/5c64a93d09d3f2b26e8b81e9/html5/thumbnails/91.jpg)
Finish It Up!
91
![Page 92: PHP & MySQL Database - carme.cs.trinity.educarme.cs.trinity.edu/thicks/3343/Lectures/PHP-MySQL-Slides.pdf · PHP's mysqli Extension –1 The mysqli extension, or as it is sometimes](https://reader031.fdocuments.in/reader031/viewer/2022022719/5c64a93d09d3f2b26e8b81e9/html5/thumbnails/92.jpg)
Making Progress
92Numerical Values Should Be Right Justified
![Page 93: PHP & MySQL Database - carme.cs.trinity.educarme.cs.trinity.edu/thicks/3343/Lectures/PHP-MySQL-Slides.pdf · PHP's mysqli Extension –1 The mysqli extension, or as it is sometimes](https://reader031.fdocuments.in/reader031/viewer/2022022719/5c64a93d09d3f2b26e8b81e9/html5/thumbnails/93.jpg)
Right-Justify All Three Numeric Fields
93Numerical Values Should Be Right Justified
![Page 94: PHP & MySQL Database - carme.cs.trinity.educarme.cs.trinity.edu/thicks/3343/Lectures/PHP-MySQL-Slides.pdf · PHP's mysqli Extension –1 The mysqli extension, or as it is sometimes](https://reader031.fdocuments.in/reader031/viewer/2022022719/5c64a93d09d3f2b26e8b81e9/html5/thumbnails/94.jpg)
Center 1 Character Fields
94
![Page 95: PHP & MySQL Database - carme.cs.trinity.educarme.cs.trinity.edu/thicks/3343/Lectures/PHP-MySQL-Slides.pdf · PHP's mysqli Extension –1 The mysqli extension, or as it is sometimes](https://reader031.fdocuments.in/reader031/viewer/2022022719/5c64a93d09d3f2b26e8b81e9/html5/thumbnails/95.jpg)
Nice Format Easier With GUI
95
![Page 96: PHP & MySQL Database - carme.cs.trinity.educarme.cs.trinity.edu/thicks/3343/Lectures/PHP-MySQL-Slides.pdf · PHP's mysqli Extension –1 The mysqli extension, or as it is sometimes](https://reader031.fdocuments.in/reader031/viewer/2022022719/5c64a93d09d3f2b26e8b81e9/html5/thumbnails/96.jpg)
Don't Forget To Include A Return On All Pages
96
![Page 97: PHP & MySQL Database - carme.cs.trinity.educarme.cs.trinity.edu/thicks/3343/Lectures/PHP-MySQL-Slides.pdf · PHP's mysqli Extension –1 The mysqli extension, or as it is sometimes](https://reader031.fdocuments.in/reader031/viewer/2022022719/5c64a93d09d3f2b26e8b81e9/html5/thumbnails/97.jpg)
97
Database Systems
CSCI 3343
Dr. Thomas E. HicksComputer Science Department
Trinity University