I have started using PDO in php for the first time.
Here is my code:
$host="localhost";
$dbname="meme";
$user="root";
$pass="dream";
global $dbh;
try
{
//dbh : Database Handle
$dbh= new PDO("mysql:host=$host;dbname=$dbname,$user,$pass");
}
catch(PDOException $e)
{
echo $e->getMessage();
}
I got this error:
SQLSTATE[28000] [1045] Access denied for user 'www-data'@'localhost'
(using password: NO)
I guess its a common error as I could get a number of related posts on both Google and StackOverflow but I fail to correct it maybe because of my limited knowledge in the field. Any help is appreciated.