PHP MySQL Functions

EditRocket provides the following information on MySQL functions in the PHP source code builder.

int mysql_affected_rows ([ resource $link_identifier ] ) - Get the number of affected rows by the last INSERT, UPDATE, REPLACE or DELETE query associated with link_identifier.

int mysql_change_user ( string $user , string $password [, string $database [, resource $link_identifier ]] ) - mysql_change_user() changes the logged in user of the current active connection, or the connection given by the optional link_identifier parameter. If a database is specified, this will be the current database after the user has been changed. If the new user and password authorization fails, the current connected user stays active.

string mysql_client_encoding ([ resource $link_identifier ] ) - Retrieves the character_set variable from MySQL.

bool mysql_close ([ resource $link_identifier ] ) - mysql_close() closes the non-persistent connection to the MySQL server that's associated with the specified link identifier. If link_identifier isn't specified, the last opened link is used.

resource mysql_connect ([ string $server [, string $username [, string $password [, bool $new_link [, int $client_flags ]]]]] ) - Opens or reuses a connection to a MySQL server.

bool mysql_create_db ( string $database_name [, resource $link_identifier ] ) - mysql_create_db() attempts to create a new database on the server associated with the specified link identifier.

bool mysql_data_seek ( resource $result , int $row_number ) - mysql_data_seek() moves the internal row pointer of the MySQL result associated with the specified result identifier to point to the specified row number.

string mysql_db_name ( resource $result , int $row [, mixed $field ] ) -

resource mysql_db_query ( string $database , string $query [, resource $link_identifier ] ) - mysql_db_query() selects a database, and executes a query on it.

bool mysql_drop_db ( string $database_name [, resource $link_identifier ] ) - mysql_drop_db() attempts to drop (remove) an entire database from the server associated with the specified link identifier.

int mysql_errno ([ resource $link_identifier ] ) - Returns the error number from the last MySQL function.

string mysql_error ([ resource $link_identifier ] ) - Returns the error text from the last MySQL function. Errors coming back from the MySQL database backend no longer issue warnings. Instead, use mysql_error() to retrieve the error text.

string mysql_escape_string ( string $unescaped_string ) -

array mysql_fetch_array ( resource $result [, int $result_type ] ) - Returns an array that corresponds to the fetched row and moves the internal data pointer ahead.

array mysql_fetch_assoc ( resource $result ) - Returns an associative array that corresponds to the fetched row and moves the internal data pointer ahead.

object mysql_fetch_field ( resource $result [, int $field_offset ] ) - Returns an object containing field information. This function can be used to obtain information about fields in the provided query result.

array mysql_fetch_lengths ( resource $result ) - Returns an array that corresponds to the lengths of each field in the last row fetched by MySQL.

object mysql_fetch_object ( resource $result [, string $class_name [, array $params ]] ) - Returns an object with properties that correspond to the fetched row and moves the internal data pointer ahead.

array mysql_fetch_row ( resource $result ) - Returns a numerical array that corresponds to the fetched row and moves the internal data pointer ahead.

string mysql_field_flags ( resource $result , int $field_offset ) - mysql_field_flags() returns the field flags of the specified field.

int mysql_field_len ( resource $result , int $field_offset ) - mysql_field_len() returns the length of the specified field.

string mysql_field_name ( resource $result , int $field_offset ) - mysql_field_name() returns the name of the specified field index.

bool mysql_field_seek ( resource $result , int $field_offset ) - Seeks to the specified field offset.

string mysql_field_table ( resource $result , int $field_offset ) - Returns the name of the table that the specified field is in.

string mysql_field_type ( resource $result , int $field_offset ) -

bool mysql_free_result ( resource $result ) - mysql_free_result() will free all memory associated with the result identifier result.

string mysql_get_client_info ( void ) - mysql_get_client_info() returns a string that represents the client library version.

string mysql_get_host_info ([ resource $link_identifier ] ) - Describes the type of connection in use for the connection, including the server host name.

int mysql_get_proto_info ([ resource $link_identifier ] ) - Retrieves the MySQL protocol.

string mysql_get_server_info ([ resource $link_identifier ] ) - Retrieves the MySQL server version.

string mysql_info ([ resource $link_identifier ] ) - Returns detailed information about the last query.

int mysql_insert_id ([ resource $link_identifier ] ) - Retrieves the ID generated for an AUTO_INCREMENT column by the previous INSERT query.

resource mysql_list_dbs ([ resource $link_identifier ] ) - Returns a result pointer containing the databases available from the current mysql daemon.

resource mysql_list_fields ( string $database_name , string $table_name [, resource $link_identifier ] ) - Retrieves information about the given table name.

resource mysql_list_processes ([ resource $link_identifier ] ) - Retrieves the current MySQL server threads.

resource mysql_list_tables ( string $database [, resource $link_identifier ] ) - Retrieves a list of table names from a MySQL database.

int mysql_num_fields ( resource $result ) - Retrieves the number of fields from a query.

int mysql_num_rows ( resource $result ) - Retrieves the number of rows from a result set. This command is only valid for statements like SELECT or SHOW that return an actual result set.

resource mysql_pconnect ([ string $server [, string $username [, string $password [, int $client_flags ]]]] ) - Establishes a persistent connection to a MySQL server.

bool mysql_ping ([ resource $link_identifier ] ) - Checks whether or not the connection to the server is working. If it has gone down, an automatic reconnection is attempted. This function can be used by scripts that remain idle for a long while, to check whether or not the server has closed the connection and reconnect if necessary.

resource mysql_query ( string $query [, resource $link_identifier ] ) - mysql_query() sends an unique query (multiple queries are not supported) to the currently active database on the server that's associated with the specified link_identifier.

string mysql_real_escape_string ( string $unescaped_string [, resource $link_identifier ] ) -

string mysql_result ( resource $result , int $row [, mixed $field ] ) - Retrieves the contents of one cell from a MySQL result set.

bool mysql_select_db ( string $database_name [, resource $link_identifier ] ) - Sets the current active database on the server that's associated with the specified link identifier.

bool mysql_set_charset ( string $charset [, resource $link_identifier ] ) - Sets the default character set for the current connection.

string mysql_stat ([ resource $link_identifier ] ) - mysql_stat() returns the current server status.

string mysql_tablename ( resource $result , int $i ) - Retrieves the table name from a result.

int mysql_thread_id ([ resource $link_identifier ] ) - Retrieves the current thread ID.

resource mysql_unbuffered_query ( string $query [, resource $link_identifier ] ) -