New Page  |  Edit Page

 

MySQLi - Object Orientated

The following is considered up to date with PHP 8.1. Wrappers and common practices found elsewhere should be considered wrong practice.

CONNECT


mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
$mysqli = new mysqli($host, $username, $password, $database, $port);
$mysqli->set_charset($charset);
$mysqli->options(MYSQLI_OPT_INT_AND_FLOAT_NATIVE, 1);

Connect to the Database

$mysqli->close;

Close the connection to the Database