<?php
$con =mysql_connect (' localhost ', ' root ', ' 1234 ');
Echo '
Echo mysql_client_encoding ();//Returns the encoding of the current database
Mysql_data_seek (Result, row_number): Moves the data interior pointer to the specified line; result
Is mysql_query (): The data set obtained
Mysql_list_dbs ($con): function lists all database names in the MySQL server
Mysql_db_name (Result, Row,field): function Gets the name of the database returned by the Mysql_list_dbs () call
Result:mysql_list_dbs () Returns the result, row: line number, starting with 0, field: Name
eg.
Echo '
$dblist =mysql_list_dbs ($con);
$len =mysql_num_rows ($dblist);
for ($i =0; $i < $len; $i + +) {
Echo Mysql_db_name ($dblist, $i, 0);
Echo ';
}
Mysql_close ($con);//close non-persistent database connection, note, do not close mysql_pconnect (), established persistent connection
The Mysql_errno () function returns the numeric encoding of the error message in a MySQL operation and returns 0 if there is no error.
Mysql_fetch_field (Data,field_offset): function obtains column information from the result set and returns as an object
property of the returned object
Name-Column Name
Table-the name of the row in which the column resides
Max_length-Maximum length of the column
NOT_NULL-1, if the column cannot be null
Primary_key-1, if the column is primary key
Unique_key-1, if the column is a unique key
Multiple_key-1, if the column is Non-unique key
Numeric-1, if the column is numeric
Blob-1, if the column is a BLOB
Type-Types of this column
Unsigned-1, if the column is an unsigned number
ZEROFILL-1, if the column is Zero-filled,eg
Echo '
/*
$db _select=mysql_select_db (' mydbtest ', $con);
$sql = ' select * from Mytab ';
$result =mysql_query ($sql);
while ($obj =mysql_fetch_field ($result)) {
echo "Field name:". $obj->name. "<br/>";
echo "Table name:". $obj->table. "<br/>";
echo "Default value:". $obj->def. "<br/>";
echo "Max length:". $obj->max_length. "<br/>";
echo "Not NULL:". $obj->not_null. "<br/>";
echo "Primary Key:". $obj->primary_key. "<br/>";
echo "Unique Key:". $obj->unique_key. "<br/>";
echo "mutliple Key:". $obj->multiple_key. "<br/>";
echo "Numeric Field:". $obj->numeric. "<br/>";
echo "BLOB:". $obj->blob. "<br/>";
echo "Field Type:". $obj->type. "<br/>";
echo "Unsigned:". $obj->unsigned. "<br/>";
echo "zero-filled:". $obj->zerofill. "<br/><br/>";
}
Mysql_close ($con);
*/
Mysql_fetch_lengths (Result): function gets the content length of each field in a row
Echo '
Mysql_field_flags (Data,offset): function gets the identity associated with the specified field from the result
Mysql_field_len (Result, Field_offset): Returns the length of the specified field
Mysql_field_name (Result, Field_offset): Returns the name of the specified field
Mysql_field_seek (Result, Field_offset): function sets the pointer in the result set to the specified field offset
Mysql_field_table (Result, Field_offset): function returns the name of the table in which the specified field is located
Mysql_field_type (Result, Field_offset): function returns the type of the specified field
Mysql_free_result (Result): The function frees the resulting memory.
Mysql_get_client_info (): function returns MySQL client information.
Mysql_get_host_info (): function returns MySQL host information.
Mysql_get_proto_info (): The function returns information about the MySQL protocol.
Mysql_get_server_info (): function returns information for MySQL server
Mysql_info (): function returns information for the most recent query. If successful, returns information about the statement, or False if it fails.
MYSQL_INSERT_ID (): The function returns the ID generated by the previous insert operation, and if a query in Shenyang does not produce an ID of auto_increament, MYSQL_INSERT_ID returns 0;
Mysql_list_processes (Connection): Function list MySQL process
Mysql_num_rows (Result): function returns the number of fields in the result set
Mysql_num_rows (Result): function returns the number of rows in the result set
Mysql_pconnect (Server,user,pwd,clientflag): function to open a persistent connection for an island MySQL service
Mysql_ping (): function ping A link, if not then reconnect
mysql_query (query): function executes a MySQL query
Mysql_real_escape_string (unescaped_string): function escapes special characters in strings used in SQL statements.
Typically used to process the front-end access data to improve the security of the data
Mysql_stat (): function returns the current system state of the MySQL server
MYSQL_THREAD_ID (): function returns the ID of the current thread
Mysql_unbuffered_query (query,connection): function sends a query to MySQL (does not get/buffer results)
Connection Optional
?>
This article is from "Tiger Brother's Blog" blog, please be sure to keep this source http://7613577.blog.51cto.com/7603577/1533782