PHP often needs to access the data in the database in advance. How can we get the data in advance?
<? Phpinclude ("conn. php "); // database connection $ SQL =" select * from study_ SQL "; // query all data records in the database table named study_ SQL $ res = mysql_query ($ SQL ); // send an SQL statement to the database // $ arr = mysql_fetch_row ($ res ); // obtain the first information in the database echo '<table apgn = "center" width = "800" border = "1"> '; // The obtained data is displayed in the table echo '<cabtion>
Common SQL functions are as follows:
Mysql_affected_rows-obtain the number of records affected by the previous MySQL operation
Mysql_cpent_encoding-name of the returned Character Set
Mysql_close-close MySQL connection
Mysql_connect-open a connection to the MySQL server
Mysql_create_db-create a MySQL database
Mysql_data_seek-move internal result pointer
Mysql_db_name-get result data
Mysql_db_query-send a MySQL Query
Mysql_drop_db-Discard (delete) a MySQL database
Mysql_errno-returns the numeric encoding of the error message in the previous MySQL operation
Mysql_error-return the text error message generated by the previous MySQL operation
Mysql_escape_string-escape a string for mysql_query
Mysql_fetch_array-get a row from the result set as an associated array, or number array, or both
Mysql_fetch_assoc-get a row from the result set as the associated array
Mysql_fetch_field-retrieve column information from the result set and return it as an object
Mysql_fetch_lengths-length of each output in the result set
Mysql_fetch_object-get a row from the result set as an object
Mysql_fetch_row-retrieve a row from the result set as an enumerated Array
Mysql_field_flags-retrieve the flag associated with the specified field from the result
Mysql_field_len-return the length of the specified field
Mysql_field_name-field name of the specified field in the result obtained
Mysql_field_seek-set the pointer in the result set to the specified field offset.
Mysql_field_table-get the name of the table where the specified field is located
Mysql_field_type-specify the field type in the result set.
Mysql_free_result-release result memory
Mysql_get_cpent_info-obtain MySQL client information
Mysql_get_host_info-obtain MySQL host information
Mysql_get_proto_info-obtain MySQL protocol information
Mysql_get_server_info-obtain MySQL Server Information
Mysql_info-obtain the information of the last Query
Mysql_insert_id-get the ID generated by the previous INSERT operation
Mysql_pst_dbs-list all databases on the MySQL server
Mysql_pst_fields-list fields in MySQL results
Mysql_pst_processes-list MySQL Processes
Mysql_pst_tables-list tables in the MySQL database
Mysql_num_fields-number of fields in the result set obtained
Mysql_num_rows-number of rows in the result set
Mysql_pconnect-open a persistent connection to the MySQL server
Mysql_ping-Ping a server connection. If there is no connection, reconnect.
Mysql_query-send a MySQL Query
Mysql_real_escape_string-special characters in the character strings used in the escape SQL statement, taking into account the connected Current Character Set
Mysql_result-get result data
Mysql_select_db-select MySQL database
Mysql_set_charset-set the character set of the Client
Mysql_stat-get the current system status
Mysql_tablename-get the table name
Mysql_thread_id-returns the ID of the current thread
Mysql_unbuffered_query-a row that sends an SQL query to MySQL and does not obtain or cache the result.
The above php method for getting the database result set (recommended) is all the content shared by the editor. I hope to give you a reference and support for the help house.