Mysqli: Connect

 
<?php

$host = 'localhost';
$user = 'username';
$pass = 'password';
$db   = 'database';

// Create a connection
$mysqli = new mysqli($host, $user, $pass, $db);

// Use the connection to perform Select, Insert, Updates statements

// Close the connection
$mysqli->close();
?>

 

Related Snippets

•  Mysqli: Insert
•  Mysqli: Insert from array
•  Mysqli: Update