Skip to content

Instantly share code, notes, and snippets.


codingwithsara/functions.php Secret

Created Mar 16, 2019
What would you like to do?
How to Save Image File with PHP & MySQL - #4 Insert an image
// Connect to the database.
function connectDB() {
$param = 'mysql:dbname=my_image;host=localhost';
try {
// new PDO($param, USER, PASSWORD)
$pdo = new PDO($param, 'root', 'root');
return $pdo;
} catch (PDOException $e) {
echo $e->getMessage();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment