0% found this document useful (0 votes)
4 views1 page

Config PHP

The document is a PHP script that establishes a connection to a MySQL database named 'b2b_system' using PDO. It specifies connection parameters such as host, user, password, and charset. The script includes error handling to catch and display any connection errors.

Uploaded by

opolotkastin
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views1 page

Config PHP

The document is a PHP script that establishes a connection to a MySQL database named 'b2b_system' using PDO. It specifies connection parameters such as host, user, password, and charset. The script includes error handling to catch and display any connection errors.

Uploaded by

opolotkastin
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

<?

php

$host = 'localhost';

$db = 'b2b_system';

$user = 'root';

$pass = '';

$charset = 'utf8mb4';

$dsn = "mysql:host=$host;dbname=$db;charset=$charset";

$options = [

PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,

PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,

];

try {

$pdo = new PDO($dsn, $user, $pass, $options);

} catch (PDOException $e) {

die("Database connection failed: " . $e->getMessage());

?>

You might also like