[PHP] practical function 7_PHP tutorial-php Tutorial

Source: Internet
Author: User
[PHP] function 7. Open a connection to the MySQL server. If the connection fails, falseintmysql_connect ([stringserver [, stringusername [, stringpassword]) is returned to open a connection to the MySQL service // to open a connection to the MySQL server. Returns a connector. if the connection fails, returns false.

Int mysql_connect ([string server [, string username [, string password])
// Open a persistent connection to the MySQL server

Int mysql_pconnect ([string server [, string username [, string [password])
// Close a MySQL connection. Persistent connection is not affected.

Bool mysql_close ([resource link_identifier])
// Select a MySQL database

Bool mysql_select_db (string database_name [, int link_identifier])
// Create a MySQL database

Bool mysql_create_db (string database name [, int link_identifier])
// Delete a MySQL database

Bool mysql_drop_db (string database_name [, int link_identifier])
// Send an SQL query to MySQL

Int mysql_querry (string query [, int link_identifier])
// Select a MySQL database and send an SQL query to MySQL

Int mysql_db_query (string database, string query [, int link_identifier])
// List available databases on a MySQL server

Int mysql_list_dbs (string database [, int link_identifier])
// List tables in a MySQL database

Int mysql_list_tables (string database [, int link_identifier])
// Retrieves information about table field definitions in the MySQL database. the returned result pointers can be used by the mysql_field_flags (), mysql_field_len (), mysql_field_name (), and mysql_field_type () functions.

Int mysql_list_fields (string database_name, string table_name [, int link_identifier])
// Returns the error message of the previous MySQL operation.

String mysql_error ([int link_identifier])
// Returns the error code of the previous MySQL operation.

Int mysql_errno ([int lind_identifier])
// Obtain the number of rows affected by the previous MySQL operation

Int mysql_affected_rows ([int link_identifier])
// Obtain the primary key value generated by the previous Insert operation. this value is generated by the auto_increment field of the table.

Int mysql_insert_id ([int link_identifier])
// Obtain a data item in the query result data record

Mixed mysql_result (resource result, int row [, mixed field])
// Obtain the number of records in the result set

Int mysql_num_rows (int result)
// Obtain the number of fields in the result set

Int mysql_num_fields (int result)
// Obtain The Result records in the enumerated array format

Array mysql_fetch_row (int result)
// Obtain a result record by object

Object mysql_fetch_object (int result, int [result_type]
// Used to disassemble the query result into an array variable

Array mysql_fetch_array (int result [, int result_type])
// Move the internal pointer in the result record set. If an invalid record is given, an error will occur.

Int mysql_data_seek (int result_identifier, int row_number)
// Returns the length of each field of the record accessed by the previous mysql_fetch_row () in an array.

Array mysql_fetch_lengths (int result)
// Obtain the field information from the result and return it as an object

Object mysql_fetch_field (int result, int [field_offset])
// Set the result pointer to a specific field offset. This offset will be used when mysql_fetch () is called next time.

Int mysql_field_seek (int result, int field_offset)
// Obtain the field name specified in the result

String mysql_field_name (int result, int field_index)
// Obtain the specified field name

String mysql_field_table (int result, int field_offset)
// Return the length of the specified field

Int mysql_field_len (int result, int field_offset)
// Obtain the type of the specified field in result

String mysql_field_type (int result_offset)
// Obtain the flag associated with the specified field in the result. the returned flag may be: not_null, primary_key, unique_key, multiple_key, blob, unsigned, zerofill, binary, enum, auto_increment, timestamp

String mysql_field_flags (int result, int field_offset)
// Release the memory occupied by result

Bool mysql_free_result (int result)

Bytes. Returns the connector. if the connection fails, false intmysql_connect ([stringserver [, stringusername [, stringpassword]) is returned. // open a connection to the MySQL service...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.