Hi,
I am using XAMPP & I am not able to connect MySQL with PHP. I am a novice & learning from a book "php_mysql novice to ninja 5th edition"
when I type the following query in PhpMyAdmin
<?php
try
{
$pdo = new PDO(‘mysql:host=localhost;dbname=ijdb’, ‘ijdbuser’,
‘mypassword’);
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$pdo->exec(‘SET NAMES “utf8”’);
}
catch (PDOException $e)
{
$output = ‘Unable to connect to the database server.’;
exit();
}
I get the following error.
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '<?php
try
{
$pdo = new PDO(‘mysql:host=localhost:8888;dbname=ijdb’, ‘ijdbuser’,
‘’ at line 1
Please help me to solve this problem