MySQL Improved Extension

Table of Contents

The mysqli class

Introduction

Represents a connection between PHP and a MySQL database.

Class synopsis

mysqli
class mysqli {
/* Properties */
int$mysqli->affected_rows;
string$mysqli->client_info;
int$mysqli->client_version;
string$mysqli->connect_errno;
string$mysqli->connect_error;
int$mysqli->errno;
array$mysqli->error_list;
string$mysqli->error;
int$mysqli->field_count;
int$mysqli->client_version;
string$mysqli->host_info;
string$mysqli->protocol_version;
string$mysqli->server_info;
int$mysqli->server_version;
string$mysqli->info;
mixed$mysqli->insert_id;
string$mysqli->sqlstate;
int$mysqli->thread_id;
int$mysqli->warning_count;
/* Methods */
__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") ]]]]]] )
bool autocommit ( bool $mode )
bool change_user ( string $user , string $password , string $database )
string character_set_name ( void )
bool close ( void )
bool commit ([ int $flags [, string $name ]] )
bool debug ( string $message )
bool dump_debug_info ( void )
object get_charset ( void )
string get_client_info ( void )
bool get_connection_stats ( void )
mysqli_warning get_warnings ( void )
mysqli init ( void )
bool kill ( int $processid )
bool more_results ( void )
bool multi_query ( string $query )
bool next_result ( void )
bool options ( int $option , mixed $value )
bool ping ( void )
public static int poll ( array &$read , array &$error , array &$reject , int $sec [, int $usec ] )
mysqli_stmt prepare ( string $query )
mixed query ( string $query [, int $resultmode = MYSQLI_STORE_RESULT ] )
bool real_connect ([ string $host [, string $username [, string $passwd [, string $dbname [, int $port [, string $socket [, int $flags ]]]]]]] )
string escape_string ( string $escapestr )
bool real_query ( string $query )
public mysqli_result reap_async_query ( void )
public bool refresh ( int $options )
bool rollback ([ int $flags [, string $name ]] )
int rpl_query_type ( string $query )
bool select_db ( string $dbname )
bool send_query ( string $query )
bool set_charset ( string $charset )
bool set_local_infile_handler ( mysqli $link , callable $read_func )
bool ssl_set ( string $key , string $cert , string $ca , string $capath , string $cipher )
string stat ( void )
mysqli_stmt stmt_init ( void )
mysqli_result store_result ( void )
mysqli_result use_result ( void )
}

The mysqli_stmt class

Introduction

Represents a prepared statement.

Class synopsis

mysqli_stmt
class mysqli_stmt {
/* Properties */
int$mysqli_stmt->affected_rows;
int$mysqli_stmt->errno;
array$mysqli_stmt->error_list;
string$mysqli_stmt->error;
int$mysqli_stmt->field_count;
int$mysqli_stmt->insert_id;
int$mysqli_stmt->num_rows;
int$mysqli_stmt->param_count;
string$mysqli_stmt->sqlstate;
/* Methods */
int attr_get ( int $attr )
bool attr_set ( int $attr , int $mode )
bool bind_param ( string $types , mixed &$var1 [, mixed &$... ] )
bool bind_result ( mixed &$var1 [, mixed &$... ] )
bool close ( void )
void data_seek ( int $offset )
bool execute ( void )
bool fetch ( void )
void free_result ( void )
mysqli_result get_result ( void )
object get_warnings ( mysqli_stmt $stmt )
mixed prepare ( string $query )
bool reset ( void )
mysqli_result result_metadata ( void )
bool send_long_data ( int $param_nr , string $data )
bool store_result ( void )
}

The mysqli_result class

Introduction

Represents the result set obtained from a query against the database.

Changelog

Changelog
Version Description
5.4.0 Iterator support was added, as mysqli_result now implements Traversable.

Class synopsis

mysqli_result
class mysqli_result implements Traversable {
/* Properties */
int$mysqli_result->current_field ;
int$mysqli_result->field_count;
array$mysqli_result->lengths;
int$mysqli_result->num_rows;
/* Methods */
bool data_seek ( int $offset )
mixed fetch_all ([ int $resulttype = MYSQLI_NUM ] )
mixed fetch_array ([ int $resulttype = MYSQLI_BOTH ] )
array fetch_assoc ( void )
object fetch_field_direct ( int $fieldnr )
object fetch_field ( void )
array fetch_fields ( void )
object fetch_object ([ string $class_name [, array $params ]] )
mixed fetch_row ( void )
bool field_seek ( int $fieldnr )
void free ( void )
}

The mysqli_driver class

Introduction

MySQLi Driver.

Class synopsis

mysqli_driver
class mysqli_driver {
/* Properties */
public readonly string $client_info ;
public readonly string $client_version ;
public readonly string $driver_version ;
public readonly string $embedded ;
public bool $reconnect ;
public int $report_mode ;
/* Methods */
void embedded_server_end ( void )
bool embedded_server_start ( bool $start , array $arguments , array $groups )
}

Properties

client_info

The Client API header version

client_version

The Client version

driver_version

The MySQLi Driver version

embedded

Whether MySQLi Embedded support is enabled

reconnect

Allow or prevent reconnect (see the mysqli.reconnect INI directive)

report_mode

Set to MYSQLI_REPORT_OFF, MYSQLI_REPORT_ALL or any combination of MYSQLI_REPORT_STRICT (throw Exceptions for errors), MYSQLI_REPORT_ERROR (report errors) and MYSQLI_REPORT_INDEX (errors regarding indexes). See also mysqli_report.

The mysqli_warning class

Introduction

Represents a MySQL warning.

Class synopsis

mysqli_warning
class mysqli_warning {
/* Properties */
public $message ;
public $sqlstate ;
public $errno ;
/* Methods */
public __construct ( void )
public void next ( void )
}

Properties

message

Message string

sqlstate

SQL state

errno

Error number

The mysqli_sql_exception class

Introduction

The mysqli exception handling class.

Class synopsis

mysqli_sql_exception
class mysqli_sql_exception extends RuntimeException {
/* Properties */
protected string $sqlstate ;
/* Inherited properties */
protected string $message ;
protected int $code ;
protected string $file ;
protected int $line ;
}

Properties

sqlstate

The sql state with the error.