THE WORLD'S LARGEST WEB DEVELOPER SITE

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 mysqli_init() function initializes MySQLi and returns an object to use with the mysqli_real_connect() function.


Syntax

mysqli_init();

Technical Details

Return Value: Returns an object
PHP Version: 5+

❮ PHP MySQLi Reference