Professional Documents
Culture Documents
Chapter 4 PHP With MySQL
Chapter 4 PHP With MySQL
CHAPTER 4:
PHP with MySQL
Topics covered:-
Connecting to MySQL
SQL Insert, Update, Delete, Select
Secure SQL
Learning Outcomes
At the end of this chapter, you should be able to :
Introduction (1)
• The mysqli (MySQL Improved) package became available with
PHP 5 and is designed to work with MySQL version 4.1.3 and
later
• Earlier versions must use the mysql package
• The mysqli package is the object-oriented equivalent of the
mysql package
• For information of data types supported in MySQL, refer to the
document “List of MySQL Data Types.doc”
• For details of functions and commands available in MySQL,
refer to MySQL reference manual at
http://dev.mysql.com/doc/
Introduction (2)
• Basic steps in querying database from the web
1. Validate data submitted by the user
2. Set up the connection to the database
3. Query the database
4. For a SELECT query, 2 further steps involved
4.1 Retrieve results
4.2 Present results back to the user
5. Disconnect from the database
Note : SHA1() function is used for encrypting data and NOW() function returns
current date and time
AMIT 2043 Web Systems and Technologies
Chapter 4 PHP with MySQL Slide 11
MYSQLI_NUM $row[0]
PhpProject6\register_v2.php
References
• PHP 6 and MySQL 5 by Ullman, L. Peachpit Press