PHP workshop for 2 days with Shopware, Sylius, PHPUnit and Codeception in Duisburg

mysqli_connect

(PHP 5, PHP 7, PHP 8)

mysqli_connectSinônimo de mysqli::__construct()

Descrição

Esta função é um apelido para: mysqli::__construct()

Nota:

If mysqli exception mode is not enabled and a connection fails, then mysqli_connect() returns false instead of an object. The mysqli_connect_error() function can be used to fetch the connection error.

add a note add a note

User Contributed Notes 1 note

up
-55
mparsa1372 at gmail dot com
7 months ago
Example (MySQLi Object-Oriented)

<?php
$servername
= "localhost";
$username = "username";
$password = "password";

// Create connection
$conn = new mysqli($servername, $username, $password);

// Check connection
if ($conn->connect_error) {
  die(
"Connection failed: " . $conn->connect_error);
}
echo
"Connected successfully";
?>
To Top