{"id":5678,"date":"2014-04-05T04:21:20","date_gmt":"2014-04-05T04:21:20","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/04\/05\/using-pdo-to-connect-mysql-database-not-working-collection-of-common-programming-errors\/"},"modified":"2014-04-05T04:21:20","modified_gmt":"2014-04-05T04:21:20","slug":"using-pdo-to-connect-mysql-database-not-working-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/04\/05\/using-pdo-to-connect-mysql-database-not-working-collection-of-common-programming-errors\/","title":{"rendered":"using PDO to connect Mysql database not working-Collection of common programming errors"},"content":{"rendered":"<ul>\n<li>\n<p>Apache version: Apache\/2.2.21 (Win32) PHP\/5.3.10<\/p>\n<\/li>\n<li>\n<p>in the php.ini file, I un-commented the line: extension=php_mysql.dll<\/p>\n<p>2a. phpinfo function showed &#8216;Loaded Configuration File&#8217; location is C:\\php\\php.ini<\/p>\n<p>2b. PDO driver information showed by phpinfo function: under PDO section: PDO drivers&#8211;&gt;Mysql (enabled) under PDO Driver for MySQL section: client API version&#8211;&gt;mysqlnd 5.0.8-dev &#8211; 20102224 &#8211; $Revision: 321634 $ (enabled)<\/p>\n<p>Code I used to connection to the database<\/p>\n<pre><code><br \/>$db_user = \"uid\";\n$db_pass = \"pd\";<br \/><br \/> <br \/>$db_connect = new PDO('mysql:host=locahost; dbname=practice; charset=UTF-8', $db_user, $db_pass); if($db_connect){ print \"connected to the db \" . \"<br \/>\"; }<br \/><br \/> <br \/>else{ print \"error connects to the db. \" . mysql_error(); }<br \/><br \/> <br \/>?&gt;\n<br \/><br \/><\/code><\/pre>\n<p>The error message I received:<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Apache version: Apache\/2.2.21 (Win32) PHP\/5.3.10 in the php.ini file, I un-commented the line: extension=php_mysql.dll 2a. phpinfo function showed &#8216;Loaded Configuration File&#8217; location is C:\\php\\php.ini 2b. PDO driver information showed by phpinfo function: under PDO section: PDO drivers&#8211;&gt;Mysql (enabled) under PDO Driver for MySQL section: client API version&#8211;&gt;mysqlnd 5.0.8-dev &#8211; 20102224 &#8211; $Revision: 321634 $ (enabled) [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-5678","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/5678","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=5678"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/5678\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=5678"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=5678"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=5678"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}