Skip to content

Instantly share code, notes, and snippets.

@TannicArcher
Created December 19, 2023 12:56
Show Gist options
  • Save TannicArcher/4533a0c2fea595668974a4aaa4206ca6 to your computer and use it in GitHub Desktop.
Save TannicArcher/4533a0c2fea595668974a4aaa4206ca6 to your computer and use it in GitHub Desktop.
MYSQLi connect
<?php
$servername = "ваш_хост";
$username = "ваше_имя_пользователя";
$password = "ваш_пароль";
$dbname = "ваша_база_данных";
// Создаем подключение
$conn = new mysqli($servername, $username, $password, $dbname);
// Проверяем соединение
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
echo "Connected successfully";
// Закрываем соединение
$conn->close();
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment