-
-
Save codingwithsara/35755411544b8929f2124c3031fee083 to your computer and use it in GitHub Desktop.
How to Save Image File with PHP & MySQL - #4 Insert an image
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// 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(); | |
exit(); | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment