MySQL database functions and MySQL database function libraries

Source: Internet
Author: User
Tags pconnect

MySQL database functions are frequently used in actual operations. Therefore, it is best to have a certain understanding of MySQL database functions. I found this article very well on a website, I have made a special offer for you to share with you today. I hope you will have some gains.

This function library provides access to the MySQL database (the best combination with PHP. For details about MySQL (the best combination with PHP) and the download of MySQL (the best combination with PHP) database, please visit this URL http://www.MySQL (the best combination with PHP ). com.

There are also a lot of web interface programs that provide the best combination of MySQL (and PHP), it is recommended to download phpMyAdmin to the http://www.phpwizard.net/phpMyAdmin, you can use a browser to operate and manage MySQL (the best combination of PHP and MySQL ). The entire phpMyAdmin program is completed with PHP3. You can also study the link between PHP3 and MySQL (the best combination with PHP.

MySQL (the best combination with PHP) _ affected_rows: gets the number of columns affected by the last operation of MySQL (the best combination with PHP.

MySQL (the best combination with PHP) _ close: close the connection to the MySQL (the best combination with PHP) server.

MySQL (the best combination with PHP) _ connect: connect to the MySQL (the best combination with PHP) server.

MySQL (the best combination with PHP) _ create_db: Creates a new MySQL (the best combination with PHP) database.

MySQL (the best combination with PHP) _ data_seek: Move the internal return pointer.

MySQL (the best combination with PHP) _ db_query: Send query strings to MySQL (the best combination with PHP) databases.

MySQL (the best combination with PHP) _ drop_db: remove the database.

MySQL (the best combination with PHP) _ errno: returns the error code.

MySQL (the best combination with PHP) _ error: returns an error message.

MySQL (the best combination with PHP) _ fetch_array: returns array data.

MySQL (the best combination with PHP) _ fetch_field: obtains field information.

MySQL (the best combination with PHP) _ fetch_lengths: returns the maximum length of each column in a single column.

MySQL (the best combination with PHP) _ fetch_object: returns class data.

MySQL (the best combination with PHP) _ fetch_row: returns each field in a single column.

MySQL (the best combination with PHP) _ field_name: returns the name of the specified field.

MySQL (the best combination with PHP) _ field_seek: configure a pointer to a field returned value.

MySQL (best combination with PHP) _ field_table: obtains the name of the table of the current field.

MySQL (the best combination with PHP) _ field_type: obtains the type of the current field.

MySQL (the best combination with PHP) _ field_flags: gets the flag of the current field.

MySQL (the best combination with PHP) _ field_len: gets the length of the current field.

MySQL (the best combination with PHP) _ free_result: releases the returned memory usage.

MySQL (the best combination with PHP) _ insert_id: returns the ID of the last INSERT command.

MySQL (the best combination with PHP) _ list_fields: Lists fields in a specified data table ).

MySQL (the best combination with PHP) _ list_dbs: lists the databases available for MySQL (the best combination with PHP) servers ).

MySQL (the best combination with PHP) _ list_tables: lists the tables of a specified database ).

MySQL (the best combination with PHP) _ num_fields: gets the number of returned fields.

MySQL (the best combination with PHP) _ num_rows: gets the number of returned columns.

MySQL (the best combination with PHP) _ pconnect: Enables continuous connection to the MySQL (the best combination with PHP) server.

MySQL (the best combination with PHP) _ query: returns a query string.

MySQL (the best combination with PHP) _ result: gets the query result.

MySQL (the best combination with PHP) _ select_db: select a database.

MySQL (the best combination with PHP) _ tablename: Get the table name.

MySQL (best combination with PHP) _ affected_rows

Obtain the number of columns affected by the last operation of MySQL (the best combination with PHP.

Syntax: int MySQL (the best combination with PHP) _ affected_rows (int [link_identifier]);

Return Value: integer

MySQL database function type: Database Function

Description: This function obtains the number of columns (row) affected by the INSERT, UPDATE, or DELETE operation in MySQL (the best combination with PHP. If the last query is DELETE and the WHERE command is not used, all data is deleted. This function returns 0.

If SELECT is used at the end, the expected number will not be obtained using this function, because it is only effective to change the MySQL (the best combination with PHP) database function, to obtain the number returned by the SELECT statement, use the _ num_rows () function of MySQL (the best combination with PHP.

MySQL (best combination with PHP) _ close

Close the connection to the MySQL (best combination with PHP) server.

Syntax: int MySQL (the best combination with PHP) _ close (int [link_identifier]);

Return Value: integer

Function Type: database functions

Description: This function closes the connection to the database server of MySQL (the best combination with PHP. If the link_identifier parameter is not specified, the last connection is closed. If you use MySQL (the best combination with PHP) _ pconnect () connection, you cannot use this function to close it. In fact, this function is not required. When the PHP full-page program ends, the non-permanent (non-persistent) connection to the database will be automatically closed. True is returned for success and false is returned for failure.

Reference: MySQL (the best combination with PHP) _ connect () MySQL (the best combination with PHP) _ pconnect ()

MySQL (best combination with PHP) _ connect

Open the MySQL (best combination with PHP) server connection.

Syntax: int MySQL (the best combination with PHP) _ connect (string [hostname] [: port], string [username], string [password]);

Return Value: integer

Function Type: database functions

Description: This MySQL database function establishes a connection with the MySQL (the best combination with PHP) server. All parameters can be omitted. When you use this function without adding any parameters, the default value of the hostname parameter is localhost, the default value of the username parameter is the owner of the PHP route execution, and the parameter password is a null string (that is, no password ). The hostname parameter can be followed by a colon and port number, indicating that the port is connected to MySQL (the best combination with PHP. Of course, when using a database, you can use MySQL (the best combination with PHP) _ close () to close the connection earlier, which can save resources.

Example

This is an example provided by an anonymous user (18-Feb-1999)

 
 
  1. <? Php
  2. $ Dbh = MySQL (the best combination with PHP) _ connect ('localhost: 100', 'mcclain', 'standard ');
  3. MySQL (the best combination with PHP) _ select_db ('admreqs ');
  4. $ Query = "insert into requests (date, request, email, priority, status) values (NOW (), '$ description',' $ email ',' $ priority ', 'new ')";
  5. $ Res = MySQL (the best combination with PHP) _ query ($ query, $ dbh );
  6. $ Query = "select max (id) from requests ";
  7. $ Res = MySQL (the best combination with PHP) _ query ($ query, $ dbh );
  8. $ Err = MySQL (the best combination with PHP) _ error ();
  9. If ($ err ){
  10. Echo "An error occurred, please notify <a href = mailto: webmaster@my.site> webmaster </a> ";
  11. }
  12. $ Row = MySQL (the best combination with PHP) _ fetch_row ($ res );
  13. Echo "your future number is:". $ row [0];
  14. ?>

Reference: MySQL (the best combination with PHP) _ close () MySQL (the best combination with PHP) _ pconnect ()

MySQL (best combination with PHP) _ create_db

Create a new MySQL database (the best combination with PHP.

Syntax: int MySQL (the best combination with PHP) _ create_db (string database name, int [link_identifier]);

Return Value: integer

Function Type: database functions

Description: This function is used to create a new database ). Before establishing a server, you must connect to the server.

Reference: MySQL (the best combination with PHP) _ drop_db ()

MySQL (best combination with PHP) _ data_seek

Move the internal return pointer.

Syntax: int MySQL (the best combination with PHP) _ data_seek (int result_identifier, int row_number );

Return Value: integer

Function Type: database functions

Description: This MySQL database function can move the column pointer returned internally to the specified row_number. Then, if MySQL (the best combination with PHP) _ fetch_row () is used, the value of the new column is returned. Returns true if the call succeeds or false if the call fails.

MySQL (best combination with PHP) _ db_query

Send the query string to the MySQL database (the best combination with PHP.

Syntax: int MySQL (the best combination with PHP) _ db_query (string database, string query, int [link_identifier]);

Return Value: integer

Function Type: database functions

Description: This function is used to send a query string to the backend MySQL (the best combination with PHP) database. If the parameter link_identifier that can be omitted does not exist, the program will automatically find the connection code after connecting other MySQL (the best combination with PHP) _ connect. If an error occurs, false is returned. Otherwise, the returned code is returned.

Reference: MySQL (the best combination with PHP) _ connect ()

MySQL (best combination with PHP) _ drop_db

Remove a database.

Syntax: int MySQL (the best combination with PHP) _ drop_db (string database_name, int [link_identifier]);

Return Value: integer

Function Type: database functions

Description: This function removes an existing database. Returns true if the call succeeds or false if the call fails.

Reference: MySQL (best combination with PHP) _ create_db ()

MySQL (best combination with PHP) _ errno

Return Error code.

Syntax: int MySQL (the best combination with PHP) _ errno (int [link_identifier]);

Return Value: integer

Function Type: database functions

Content Description: This function can get the error code of the MySQL (the best combination with PHP) database server. It is usually used in the development phase of PHP web programs and serves as the debugging and use of PHP and MySQL (the best combination with PHP.

Example

<? Php

MySQL (the best combination with PHP) _ connect ("marliesle ");

Echo MySQL (the best combination with PHP) _ errno (). ":". MySQL (the best combination with PHP) _ error (). "<BR> ";

MySQL (best combination with PHP) _ select_db ("nonexistentdb & quo

The above content is the description of MySQL database functions, hoping to help you in this regard.

Related Article

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.