mysqli 클래스
(PHP 5, PHP 7, PHP 8)
소개
PHP와 MySQL 데이터베이스 간의 연결을 나타냅니다.
클래스 개요
class mysqli {
/* Properties */
public int|string $affected_rows;
public string $client_info;
public int $client_version;
public int $connect_errno;
public ?string $connect_error;
public int $errno;
public string $error;
public array $error_list;
public int $field_count;
public string $host_info;
public ?string $info;
public int|string $insert_id;
public string $server_info;
public int $server_version;
public string $sqlstate;
public int $protocol_version;
public int $thread_id;
public int $warning_count;
/* Methods */
public __construct(
string $hostname = ini_get("mysqli.default_host"),
string $username = ini_get("mysqli.default_user"),
string $password = ini_get("mysqli.default_pw"),
string $database = "",
int $port = ini_get("mysqli.default_port"),
string $socket = ini_get("mysqli.default_socket")
)
public autocommit(bool $enable): bool
public begin_transaction(int $flags = 0, ?string $name = null): bool
public change_user(string $username, string $password, ?string $database): bool
public character_set_name(): string
public close(): bool
public commit(int $flags = 0, ?string $name = null): bool
public connect(
string $hostname = ini_get("mysqli.default_host"),
string $username = ini_get("mysqli.default_user"),
string $password = ini_get("mysqli.default_pw"),
string $database = "",
int $port = ini_get("mysqli.default_port"),
string $socket = ini_get("mysqli.default_socket")
): void
public debug(string $options): bool
public dump_debug_info(): bool
public get_charset(): ?object
public get_client_info(): string
public get_connection_stats(): array
public get_server_info(): string
public get_warnings(): mysqli_warning|false
public kill(int $process_id): bool
public more_results(): bool
public multi_query(string $query): bool
public next_result(): bool
public options(int $option, string|int $value): bool
public ping(): bool
public static poll(
?array &$read,
?array &$error,
array &$reject,
int $seconds,
int $microseconds = 0
): int|false
public prepare(string $query): mysqli_stmt|false
public query(string $query, int $result_mode = MYSQLI_STORE_RESULT): mysqli_result|bool
public real_connect(
string $host = ?,
string $username = ?,
string $passwd = ?,
string $dbname = ?,
int $port = ?,
string $socket = ?,
int $flags = ?
): bool
public real_escape_string(string $string): string
public real_query(string $query): bool
public reap_async_query(): mysqli_result|bool
public refresh(int $flags): bool
public release_savepoint(string $name): bool
public rollback(int $flags = 0, ?string $name = null): bool
public savepoint(string $name): bool
public select_db(string $database): bool
public set_charset(string $charset): bool
public ssl_set(
?string $key,
?string $certificate,
?string $ca_certificate,
?string $ca_path,
?string $cipher_algos
): bool
public stat(): string|false
public stmt_init(): mysqli_stmt|false
public store_result(int $mode = 0): mysqli_result|false
public thread_safe(): bool
public use_result(): mysqli_result|false
}
목차
- mysqli::$affected_rows — 이전 MySQL 작업에서 영향을 받은 행 수를 가져옵니다.
- mysqli::autocommit — 데이터베이스 수정 자동 커밋을 켜거나 끕니다.
- mysqli::begin_transaction — 트랜잭션 시작
- mysqli::change_user — 지정된 데이터베이스 연결의 사용자를 변경합니다.
- mysqli::character_set_name — 데이터베이스 연결의 현재 문자 집합을 반환합니다.
- mysqli::close — 이전에 열린 데이터베이스 연결을 닫습니다.
- mysqli::commit — 현재 트랜잭션을 커밋합니다.
- mysqli::$connect_errno — 마지막 연결 호출에서 오류 코드를 반환합니다.
- mysqli::$connect_error — 마지막 연결 오류에 대한 설명을 반환합니다.
- mysqli::__construct — MySQL 서버에 대한 새 연결 열기
- mysqli::debug — 디버깅 작업을 수행합니다.
- mysqli::dump_debug_info — 디버깅 정보를 로그에 덤프
- mysqli::$errno — 가장 최근의 함수 호출에 대한 오류 코드를 반환합니다.
- mysqli::$error_list — 마지막으로 실행된 명령의 오류 목록을 반환합니다.
- mysqli::$error — 마지막 오류에 대한 문자열 설명을 반환합니다.
- mysqli::execute_query — SQL 문 준비, 매개변수 바인딩 및 실행
- mysqli::$field_count — 가장 최근 쿼리의 열 수를 반환합니다.
- mysqli::get_charset — 문자 집합 개체를 반환합니다.
- mysqli::$client_info — MySQL 클라이언트 정보 가져오기
- mysqli::$client_version — MySQL 클라이언트 버전을 정수로 반환
- mysqli::get_connection_stats — 클라이언트 연결에 대한 통계를 반환합니다.
- mysqli::$host_info — 사용된 연결 유형을 나타내는 문자열을 반환합니다.
- mysqli::$protocol_version — 사용된 MySQL 프로토콜의 버전을 반환합니다.
- mysqli::$server_info — MySQL 서버의 버전을 반환합니다.
- mysqli::$server_version — MySQL 서버의 버전을 정수로 반환
- mysqli::get_warnings — 경고 표시 결과 가져오기
- mysqli::$info — 가장 최근에 실행된 쿼리에 대한 정보를 검색합니다.
- mysqli::init — MySQLi를 초기화하고 mysqli_real_connect()와 함께 사용할 객체를 반환합니다.
- mysqli::$insert_id — 마지막 쿼리에 의해 AUTO_INCREMENT 열에 대해 생성된 값을 반환합니다.
- mysqli::kill — MySQL 스레드를 종료하도록 서버에 요청
- mysqli::more_results — 다중 쿼리의 쿼리 결과가 더 있는지 확인
- mysqli::multi_query — 데이터베이스에 대해 하나 이상의 쿼리를 수행합니다.
- mysqli::next_result — multi_query의 다음 결과 준비
- mysqli::options — 옵션 설정
- mysqli::ping — 서버 연결을 Ping하거나 연결이 끊어진 경우 다시 연결을 시도합니다.
- mysqli::poll — 폴 연결
- mysqli::prepare — 실행을 위해 SQL 문 준비
- mysqli::query — 데이터베이스에 대한 쿼리를 수행합니다.
- mysqli::real_connect — mysql 서버에 대한 연결을 엽니다.
- mysqli::real_escape_string — 연결의 현재 문자 집합을 고려하여 SQL 문에서 사용하기 위해 문자열의 특수 문자를 이스케이프합니다.
- mysqli::real_query — SQL 쿼리 실행
- mysqli::reap_async_query — 비동기 쿼리에서 결과 가져오기
- mysqli::refresh — 새로 고침
- mysqli::release_savepoint — 현재 트랜잭션의 저장점 집합에서 명명된 저장점을 제거합니다.
- mysqli::rollback — 현재 트랜잭션 롤백
- mysqli::savepoint — 명명된 트랜잭션 저장점 설정
- mysqli::select_db — 데이터베이스 쿼리에 대한 기본 데이터베이스를 선택합니다.
- mysqli::set_charset — 클라이언트 문자 집합을 설정합니다.
- mysqli::$sqlstate — 이전 MySQL 작업에서 SQLSTATE 오류를 반환합니다.
- mysqli::ssl_set — SSL을 사용하여 보안 연결을 설정하는 데 사용됩니다.
- mysqli::stat — 현재 시스템 상태를 가져옵니다.
- mysqli::stmt_init — 명령문을 초기화하고 mysqli_stmt_prepare와 함께 사용할 객체를 반환합니다.
- mysqli::store_result — 마지막 쿼리의 결과 집합을 전송합니다.
- mysqli::$thread_id — 현재 연결의 스레드 ID를 반환합니다.
- mysqli::thread_safe — 스레드 안전성이 부여되었는지 여부를 반환합니다.
- mysqli::use_result — 결과 집합 검색 시작
- mysqli::$warning_count — 주어진 링크에 대한 마지막 쿼리의 경고 수를 반환합니다.