Examples of PHP mysqli class demos

Source: Internet
Author: User
Share an example of PHP using the Mysqli class, and attach the method description in the Mysqli class, very comprehensive, a friend of the need to refer to it.

PHP calls the example of the Mysqli class with the following code:

 
      Set_charset ("UTF8"), $query = "select * from", if ($result = $db->query ($query)) {while    ($row = $result->fet CH_ASSOC ()) {        printf ("%s (%s) \ n", $row [' id '], $row [' cn_name ']);    }    $result->close ();} $db->close (); Instance of the//mysqli class?>

Methods in the Mysqli class, Description:

Mysqli_affected_rows-Returns the number of rows affected by a MySQL operation Mysqli_autocommit-turn autocommit database modification on or off Mysqli_bind_param-alias Mysqli_stmt_ Bind_param () Mysqli_bind_result-alias Mysqli_stmt_bind_result () Mysqli_change_user-Change the user for the specified database connection mysqli_character_set_ Name-Returns the default character set of the database connection mysqli_client_encoding-alias Mysqli_character_set_name () Mysqli_close-Closes the currently open database connection Mysqli_commit- Current thing Mysqli_connect_errno-Returns the error code of the last Operation Mysqli_connect_error-returns the error string description of the last Operation Mysqli_connect-opens a new connection to the MySQL server Mysqli_data_seek-Move the row pointer arbitrarily in the current record result set Mysqli_debug-debug Mysqli_disable_reads_from_master-disables reading of the primary pair like Mysqli_disable_rpl_ Parse-Disable RPL parsing Mysqli_dump_debug_info-log mysqli_embedded_connect of dump debug information-open a connection to the embedded MySQL server Mysqli_enable_reads_ From_master-Enable content by primary Mysqli_enable_rpl_parse-enable RPL resolution Mysqli_errno-Return error code recent function call Mysqli_error-Returns a string describing past errors Mysqli_ Escape_string-alias Mysqli_real_escape_string () Mysqli_execute-alias Mysqli_stmt_execute () Mysqli_fetch_array- Take a row from the result set as an association, a numeric array, or both carrot Mysqli_fetch_assoc-gets a row from the result set as an associative array mysqli_fetch_field_direcT-get metadata for a single domain mysqli_fetch_field-Returns the result set in the field next year Mysqli_fetch_fields-Returns an array object representing the realm's result set mysqli_fetch_lengths- Returns the result set of the current row of the length column mysqli_fetch_object-Returns the result set of the current row as an object Mysqli_fetch_row-gets a row in the result set as an enumerated array Mysqli_fetch-alias Mysqli_stmt_ Fetch () mysqli_field_count-Number of columns returned recent query Mysqli_field_seek-set as result pointer to the specified field offset Mysqli_field_tell-Gets the result pointer of the current field offset mysqli_free_ Result-free memory with result Mysqli_get_client_info-return MySQL client version as a string mysqli_get_client_version-get MySQL client info mysqli_get_host_ Info-Returns a string representing the connection type using Mysqli_get_metadata-alias Mysqli_stmt_result_metadata () Mysqli_get_proto_info-return version of the MySQL usage protocol Mysqli_get_server_info-return version of MySQL server mysqli_get_server_version-return version of MySQL server as an integer mysqli_info-retrieve information, recently executed query Mysqli_init-initializes the mysqli and returns a resource using Mysqli_real_connect () mysqli_insert_id-Returns the auto-generated number using the last query Mysqli_kill- Ask the server to kill a MySQL thread mysqli_master_query-enforce query total in master/slave settings mysqli_more_results-check if there are any more query results from a multi-query mysqli_multi_query- Execute Query Database Mysqli_next_result-prepare for next year's results Multi_query Mysqli_num_fields-Get results in several areas mysqli_num_rows-getThe result of the number of rows mysqli_options-Set options Mysqli_param_count-alias Mysqli_stmt_param_count () mysqli_ping-the ping of a server connection, or attempt to reconnect if it has dropped Mysqli_prepare-Prepare a SQL statement for execution mysqli_query-Execute Query Database mysqli_real_connect-Open a connection to the MySQL server mysqli_real_escape_string- Escapes special character strings for SQL statements, and takes into account the current character set of the connection Mysqli_real_query-execute a SQL query Mysqli_report-enable or disable the internal reporting feature mysqli_rollback-rollback the current transaction mysqli_rpl_parse_enabled-Check whether RPL parsing MYSQLI_RPL_PROBE-RPL probe is enabled Mysqli_rpl_query_type-return RPL query type mysqli_select_db- Select the default database database query Mysqli_send_long_data-alias Mysqli_stmt_send_long_data () mysqli_send_query-send query and return mysqli_server_end- Shutdown Embedded Server Mysqli_server_init-Initialize embedded server Mysqli_set_charset-Set default client character set mysqli_set_opt-alias Mysqli_options () mysqli_ SQLState-Returns SQLSTATE error from a MySQL operation Mysqli_ssl_set-used to establish a secure connection using SSL Mysqli_stat-Gets the current system state mysqli_stmt_affected_rows- Returns the total number of columns changed, deleted, or inserted in the last executed declaration mysqli_stmt_bind_param-binding variable a declaration as a parameter mysqli_stmt_bind_result-the result of a copy of the binding variable stored in a declaration mysqli_stmt_ Close-Closes a statement mysqli_stmt_data_seek-finds the result set of an arbitrary row declaration Mysqli_stmt_errno-Returns the latest statement of the error code called MYsqli_stmt_error-Returns a string that describes the last declaration error mysqli_stmt_execute-executes a prepared query Mysqli_stmt_fetch-Gets the results a prepared declaration that incorporates constraint variables Mysqli_stmt_ Free_result-Save memory results give a handle to the statement mysqli_stmt_init-initializes the statement and returns an object for Mysqli_stmt_prepare Mysqli_stmt_num_rows-the number of rows returned report result set Mysqli_stmt_param_count-Returns some arguments for the given declaration mysqli_stmt_prepare-prepares an SQL statement for execution Mysqli_stmt_reset-resets a declaration mysqli_stmt_result_ Metadata-Returns a written statement of the result set metadata Mysqli_stmt_send_long_data-send data Block Mysqli_stmt_sqlstate-return SQLSTATE error action from previous declarations Mysqli_stmt_ Store_result-The result set of the assignment consists of a statement mysqli_store_result-the final query of the result set of the transfer mysqli_thread_id-returns the thread ID for the current connection Mysqli_thread_safe- Returns whether thread safety is considered or not mysqli_use_result-creating a search result set Mysqli_warning_count-returns some warnings past queries provide links
  • 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.