Bạn có chắc chắn muốn xóa bài viết này không ?
Bạn có chắc chắn muốn xóa bình luận này không ?
Mysqli memo
1. Example
2. mysqli_connect
This function is an alias of: mysqli::__construct()
3.mysqli::__construct
a. Description
Object oriented style
mysqli::__construct ([ string $host = ini_get("mysqli.default_host") [, string $username = ini_get("mysqli.default_user") [, string $passwd = ini_get("mysqli.default_pw") [, string $dbname = "" [, int $port = ini_get("mysqli.default_port") [, string $socket = ini_get("mysqli.default_socket") ]]]]]] )
Procedural style
mysqli mysqli_connect ([ string $host = ini_get("mysqli.default_host") [, string $username = ini_get("mysqli.default_user") [, string $passwd = ini_get("mysqli.default_pw") [, string $dbname = "" [, int $port = ini_get("mysqli.default_port") [, string $socket = ini_get("mysqli.default_socket") ]]]]]] )
b. Parameter
host: Can be either a host name or an IP address
username: The MySQL user name.
passwd: If not provided or NULL, the MySQL server will attempt to authenticate the user against those user records which have no password only
dbname: If provided will specify the default database to be used when performing queries.
c. Return Values
Returns an object which represents the connection to a MySQL Server.
4. mysqli_query
a. Description
Object oriented style
mysqli::query ( string $query [, int $resultmode = MYSQLI_STORE_RESULT ] )
Procedural style
mysqli_query ( mysqli $link , string $query [, int $resultmode = MYSQLI_STORE_RESULT ] )
b. Parameter
link: Procedural style only: A link identifier returned by mysqli_connect() or mysqli_init()
query: The query string.
resultmode: Either the constant MYSQLI_USE_RESULT or MYSQLI_STORE_RESULT depending on the desired behavior. By default, MYSQLI_STORE_RESULT is used.
c. Return values
Returns FALSE on failure. For successful SELECT, SHOW, DESCRIBE or EXPLAIN queries mysqli_query() will return a mysqli_result object. For other successful queries mysqli_query() will return TRUE.
5. mysqli_fetch_assoc
a. Description
Object oriented style
mysqli_result::fetch_assoc ( void )
Procedural style
mysqli_fetch_assoc ( mysqli_result $result )
b. Parameters
result: A result set identifier returned by mysqli_query(), mysqli_store_result() or mysqli_use_result().
c. Return values
Returns an associative array of strings representing the fetched row in the result set, where each key in the array represents the name of one of the result set's columns or NULL if there are no more rows in resultset.
If two or more columns of the result have the same field names, the last column will take precedence. To access the other column(s) of the same name, you either need to access the result with numeric indices by using mysqli_fetch_row() or add alias names.







