1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

PDO connection problem

Discussion in 'PHP' started by greatlogix, Mar 29, 2011.

  1. #1
    I am getting very strange type of PDO connection problem. I am using following code to create a pdo object

    try {
        $dbase = new PDO("mysql:host=$hostname;dbname=$db", $user, $pass);
      //  echo 'Connected to database';
        }
    catch(PDOException $e)
        {
        echo $e->getMessage();
        }
    PHP:
    Code is in a include file so all pages access Mysql using this code.

    I am getting problem only in one page. At first page load everything is fine. this page submit a form to iteself. After submitting form I get this error
    SQLSTATE[28000] [1045] Access denied for user 'user_name'@'localhost' (using password: YES) (All other site pages are working fine. There is no issue in creating pdo object and accessing Mysql).

    Can somebody help me fixing this issue.
     
    greatlogix, Mar 29, 2011 IP