$dbConnection = new PDO($dsn, $user, $pass);
<?php
$servername = "localhost";
$username = "username";
$password = "password";
try {
$conn = new PDO("mysql:host=$servername;dbname=myDB", $username, $password);
// set the PDO error mode to exception
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
echo "Connected successfully";
}
catch(PDOException $e)
{
echo "Connection failed: " . $e->getMessage();
}
?>
Also in PHP:
- character split php
- create a seed laravel
- Verzeichnis einlesen php
- check if key present in array php
- convert php time()
- "$_HEADER" php
- array php remove duplicates
- Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 7.3.0". php 8
- check array has key php
- changer le format d'une date php
- customizing php time format based on location usa europe
- datetimepicker format php
- close connection pdo
- date and time function in php
- add errors php
- base64 to image php
- Carbon\Carbon::today()->format('Y-m-d') in blade
- consol log put in php
- __dir__ in php
- Which one from the following is true for creating laravel project
- creating a new project with laravel
- db show console mensage in php
- - tijsverkoyen/css-to-inline-styles 2.2.3 requires ext-dom * -> the requested PHP extension dom is missing from your system.
- artisan cache command in laravel