Skip to content

Instantly share code, notes, and snippets.

@andriyun
Last active April 14, 2021 18:29
Show Gist options
  • Save andriyun/eb7fe7b3b5c398ffb469703b553550f1 to your computer and use it in GitHub Desktop.
Save andriyun/eb7fe7b3b5c398ffb469703b553550f1 to your computer and use it in GitHub Desktop.
PHP db connection with PDO
<?php
$DB = new PDO("mysql:host=db_host;dbname=db_name", "db_user", "db_user_pass");
$statement = $DB->prepare("SHOW TABLES;");
$statement->execute();
print_r($statement->fetchAll());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment