php PDO with sql conn code example
Example 1: connect php to mysql pdo
<?php
$pdo = new PDO('mysql:host=localhost;
dbname=the_name_of_your_databe,
'username',
'password'');
# by default your username is root
# if you don't have a password don't fill in it
#(optional) :
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$pdo->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_OBJ);
?>
Example 2: php pdo sql server connect
$db = new PDO("sqlsrv:Server=YouAddress;Database=YourDatabase", "Username", "Password");