$mysqli = new mysqli("localhost", "username", "password", "database");
$result = $mysqli->query("SELECT * FROM users");
$stmt = $mysqli->prepare("INSERT INTO users (name, email) VALUES (?, ?)"); $stmt->bind_param("ss", $name, $email); $name = "John Doe"; $email = "johndoe@example.com"; $stmt->execute();
$server_info = $mysqli->server_info; $client_info = $mysqli->client_info; $host_info = $mysqli->host_info; echo "Connected to $server_info on $host_info using $client_info\n";In this example, we are retrieving information about the connection, server, and client. The mysqli extension is part of the PHP core, so you don't need to install any additional package libraries to use it.