Académique Documents
Professionnel Documents
Culture Documents
Chapter 9
Review
A variable can store only one value at a time
An array is a variable that can store a set of values of the same
data type
We can combine the element values of two or more arrays. This
process is called as merging arrays
In a single-dimensional array, the element includes only one level
of key value pairs
In the multidimensional array, each element is an array. Each
element requires an array name and multiple set of indices
Multidimensional arrays are arrays that store another array within
it
PHP / Chapter 9 / Slide 2 of 27
Objectives
Database APIs
Connecting to a database
Data access functions
Performing SQL queries using PHP
Building HTML tables using SQL queries
$link_id = mysql_connect(“host_name”,
“user_name”,“password”);
Where,
host_name – Specifies the server or the host name
user_name – Specifies the user name of MySQL
password – Specifies the password for the MySQL user
link_id - Specifies the return value of the server
connection
connection
result – Stores the result of the function
Where,
link_id - Specifies the return value of the server
connection
PHP / Chapter 9 / Slide 14 of 27
Data Access Functions
Uses MySQL functions in PHP for accessing data
from the tables of the database
Data are accessed from the tables using the following
mysql functions. Those are:
mysql_query()
mysql_fetch_array()
mysql_fetch_row()
mysql_fetch_field()
mysql_field_len()
mysql_num_fields()