PHP API

Below is a list of PHP API functions. Click on a function in the list to see more information about it, including its syntax, an explanation of its use, and examples of how it may be used to interface with MySQL.
mysql_affected_rows( )
This PHP API function returns the number of rows in MySQL that were affected by a previous SQL statement that modified rows of data in a MySQL table for the current MySQL session.
mysql_free_result( )
Use this C API function to free memory allocated under particular conditions related to MySQL.
mysql_change_user( )
Use this C API function to change the current user for the MySQL session to the one given as the second argument.
mysql_get_client_info( )
This C API function returns the MySQL client library version.
mysql_client_encoding( )
This PHP API function returns the name of the default character set for the current MySQL connection or, if the connection identification number is supplied, for that particular MySQL connection.
mysql_get_host_info( )
This C API function returns the hostname and the connection type for the current connection to MySQL.
mysql_close( )
Use this C API function to close the connection to the MySQL server.
mysql_get_proto_info( )
This C API function returns the protocol version for the current connection to MySQL.
mysql_connect( )
This C API function is deprecated in favor of mysql_real_connect( ) for connecting to MySQL.
mysql_get_server_info( )
This C API function returns a string containing the version of MySQL running on the server for the current connection.
mysql_create_db( )
This C API function can be used to create a new database on the MySQL server, with the new database name is given as the second argument.
mysql_info( )
This C API function returns a string containing information provided by MySQL when certain SQL statements are executed.
mysql_data_seek( )
Use this C API function in conjunction with mysql_store_result( ) and a fetch function to change the current row being fetched from MySQL.
mysql_insert_id( )
This C API function returns the identification number issued to the primary key of the last record inserted using INSERT in MySQL for the current connection.
mysql_db_name( )
This PHP API function returns the name of the database from the results of the mysql_list_dbs( ) PHP function, which returns a pointer to a MySQL results set containing the names of databases for a MySQL server.
mysql_list_dbs( )
This C API function returns a results set containing a list of databases found for the current connection to MySQL.
mysql_db_query( )
This PHP API function can be used to query the MySQL database given, for the current MySQL connection (unless another is specified), and to execute the SQL statement given as the second argument.
mysql_list_fields( )
This C API function returns a results set containing a list of fields found for the MySQL table given.
mysql_drop_db( )
This C API function may be used to delete the database named in the second argument of the function from the MySQL server.
mysql_list_processes( )
This C API function returns a results set containing a list of MySQL server processes or server threads found for the handle given as the argument to the function.
mysql_errno( )
This C API function returns the MySQL error number for the last function which was run if it failed to execute.
mysql_list_tables( )
This C API function returns a results set containing a list of MySQL tables in the currently selected MySQL database.
mysql_error( )
This C API function returns the MySQL error message for the last function which was run if it failed to execute.
mysql_num_fields( )
This C API function returns the number of fields in each row of a results set from MySQL.
mysql_escape_string( )
This C API function will return a string or MySQL column given with special characters escaped by adding backslashes in front of them.
mysql_num_rows( )
This C API function returns the number of rows in the results set from MySQL when issued after the mysql_store_result() function.
mysql_fetch_array( )
This PHP API function returns an array containing a row of data from a MySQL query results set.
mysql_pconnect( )
This PHP API function may be used to open a persistent connection to MySQL.
mysql_fetch_assoc( )
This PHP API function returns an associative array containing a row of data from a results set generated by a query executed in MySQL.
mysql_ping( )
Use this C API function to determine whether the current MYSQL connection is still open.
mysql_fetch_field( )
This C API function returns a MYSQL_FIELD structure that provides information on a given field of a results set.
mysql_query( )
Use this C API function to execute the MySQL query given.
mysql_fetch_lengths( )
This C API function returns the length of each column within a particular row of a results set from MySQL.
mysql_real_escape_string( )
This C API function writes a string or MySQL column given to a string named, but with special characters escaped by adding backslashes in front of them.
mysql_fetch_object( )
This PHP API function returns a row of data as an object from a given results set from MySQL.
mysql_result( )
This PHP API function returns the data from one field of a row from the results of a MySQL query.
mysql_fetch_row( )
Use this C API function to retrieve the next row of a results set from MySQL.
mysql_select_db( )
Use this C API function to select a different MySQL database for the current connection to MySQL.
mysql_field_flags( )
This PHP API function returns the field flags for a field of a given results set from MySQL.
mysql_set_charset( )
This PHP API function sets the default character set for the current connection to MySQL, or for a MySQL connection given with the function.
mysql_field_len( )
This PHP API function returns the length from a field of a given MySQL results set.
mysql_stat( )
This C API function returns a character string containing information about the status of the MySQL server for the current connection.
mysql_field_name( )
This PHP API function returns the name of a field from a given MySQL results set.
mysql_tablename( )
This PHP funtion returns the table name for a particular MySQL table in the results set given by the PHP function, mysql_list_tables( ).
mysql_field_seek( )
Use this C API function in conjunction with mysql_fetch_field( ) to change the current field being fetched to the one specified in the second argument of this function.
mysql_thread_id( )
This C API function returns the thread identifier number for the current connection to MySQL.
mysql_field_table( )
This PHP API function returns the name of the MySQL table that contains a particular field from the MySQL results set given.
mysql_unbuffered_query( )
Use this PHP function to execute a MySQL statement given without buffering the results so that you can retrieve the data from MySQL without having to wait for the results set to be completed.
mysql_field_type( )
This PHP API function returns the MySQL column datatype for a field from the MySQL results set given.