Chapter 18. MySQL PHP API Reference
In this chapter, we list the
functions that allow you to access the MySQL DBMS from PHP. We begin
by discussing two database-specific data types used in many of these
functions. The functions are then presented alphabetically with
descriptions, and each includes an example code fragment. An
introduction to PHP and examples of using PHP to access a MySQL DBMS
are presented in Chapter 11. This chapter is based
on Version 4.1.2, which was the version of PHP available at the time
this book was written, but some differences between versions are
discussed.
18.1. Data Types
The following PHP data types are specialized types for database
access:
- cresource
-
A connection resource
handle. An integer returned from the functions
mysql_connect(
), and mysql_pconnect(
). Both functions are used to
establish a connection to a MySQL DBMS, and are described later in
this chapter. The connection resource handle is used as a parameter
to several functions (such as mysql_select_db(
), mysql_query(
), and mysql_affected_rows(
)) to determine or change aspects
of the connection.
- qresource
-
A
query resource handle. An integer returned from
functions such as
mysql_query(),
mysql_list_fields(),
mysql_list_dbs(), and
mysql_unbuffered_query(). These functions are used to
execute a query through a connection resource handle, and are
described later in this chapter. A query resource handle is used as a
parameter to several functions (such as
mysql_fetch_array(),
mysql_tablename(), and
mysql_num_rows()) to retrieve a
query's output or information about the query.
| | | 17.2. Functions | | 18.2. Functions |
Copyright © 2003 O'Reilly & Associates. All rights reserved.
|
|