PHP mysqli init() Function

❮ PHP MySQLi Reference

Example

Use of the mysqli_init() function:

<?php
$con = mysqli_init();
if (!$con) {
  die("mysqli_init failed");
}

if (!mysqli_real_connect($con,"localhost","my_user","my_password","my_db")) {
  die("Connect Error: " . mysqli_connect_error());
}

mysqli_close($con);
?> 


Definition and Usage

The init / mysqli_init() function initializes MySQLi and returns an object to use with the mysqli_real_connect() function.


Syntax

Object oriented style:

$mysqli -> init

Procedural style:

mysqli_init()

Technical Details

Return Value: An object to use with the mysqli_real_connect() function
PHP Version: 5+

❮ PHP MySQLi Reference
Copyright 1999-2023 by Refsnes Data. All Rights Reserved.