we must make a database connection. Logical, isn’t it?
Solution
Here’s how we connect to a MySQL database on the localhost:
$dsn = 'mysql:host=localhost;dbname=arabic;';
$user = 'root';
$password = '';
try
{
$dbh = new PDO($dsn, $user, $password);
echo "koneksi sukses";
}
catch (PDOException $e)
{
echo 'Connection failed: ' . $e->getMessage();
}
No comments:
Post a Comment