Example of PDO - CodeTextPro | Web Tutorial | Technology

CodeTextPro.com Provides - Web design, Technology gyan, Digital marketing, Online earnings, Seo, Adsense, Technology news, Motivation and inspiration, Latest Technology Affairs, Gadgets, Blogging

Monday, December 10, 2018

Example of PDO

Example (PDO) (PHP Data Objects): 

$servername = "localhost";
$username = "username";
$password = "password";
try {   
$conn = new PDO("mysql:host=$servername",
$username, $password);   
 // set the PDO error mode to exception   
// use exec() because no results are returned   
echo "Database created successfully<br>"; 
catch(PDOException $e)   
echo $sql . "<br>" . $e->getMessage();
$conn = null;

No comments:

Post a Comment