PHP supports all the important relational databases including Oracle, IBM's DB2, Microsoft's SQL Server and Sybase to name a few. It also supports the open software database platforms like SQLite, PostgreSQL and MySQL.
Example: Connecting to a MySQL data base server.
Code: Select all
<?php
$dsn = 'mysql:host=hostName; dbname=databasName;';
$user='userName';
$Password ='passWord';
try
{
$dbh = new PDO($dsn, $user, $password);
}
catch (PDOException $e)
{
echo 'Connection failied: ' . $e->getMessage();
}
?>
http://www.php.net/pdo
http://www.php.net/manual/en/ref.pdo.php
http://www.php.net/manual/en/ref.pdo.php#pdo.drivers