title: Problems getting PDO (or mysqli extension) to run queries on database
body: <p>The main problem is that for the past week I have not been able to get my script to run queries. </p>
  
  <p>I'm running wamp apache 2.4, php 5.5 and mysql 5.6</p>
  
  <pre><code>  if ($flag == true) {
  
      //try to connect to db with given parameters
      // minimal validation to make sure no input was sent in error so now i can begin code to connect to database 
      // using the pdo php data object extension
  
      print 'all input validated';
  
      $host= "127.0.0.1";
      $db_name ="theturnbuckle";
      $port= "3306";
      $dbusername= 'root';
      $dbpassword= '';
  
      //registration details including host, port and database name
      $dsn = "mysql:host=$host;port=$port;dbname=$db_name;";
  
      //error handling for connection
      try {
         $db = new PDO($dsn, $dbusername, $dbpassword);
         //if no proplems flag a variable for connection status which is to be used later.
         $db-&gt;setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
         $db-&gt;setFetchMode(PDO::FETCH_ASSOC);
  
  
         //first query to test that the username is not in the database.
         $username = $_POST['username'];
         $userquery = "SELECT username  FROM registation_view WHERE username = :username" ; 
  
  
         //second query to test for existing email
         $email = $_POST['email'];
         $emailquery = "SELECT email FROM registation_view WHERE email = :email";
  
         //preparing statement, binding html input to variables to be used in the prepared statement.
         $db = new PDO($dsn, $dbusername, $dbpassword);
         $stmt = $db-&gt;prepare($userquery);
         $stmt-&gt;bindParam(':username', $username, PDO::PARAM_STR, 15);
  
          //execute the query in variable
          $stmt-&gt;execute($userquery);
          if ($stmt-&gt;fetchColumn() &gt; 0){
              print 'Sorry ' .$username . 'is already in use please try another';
          }//else the username is not is use as fetchColumn is null or the if is false
          else {$registerprocess === true;}
  
  
          $db = new PDO($dsn, $dbusername, $dbpassword);  
          $stmt = $db-&gt;prepare($emailquery);
          $stmt-&gt;bindParam(':email', $email, PDO::PARAM_STR, 15);
  
          $stmt-&gt;execute($emailquery);
           if ($stmt-&gt;fetchColumn() &gt; 0){
               print 'Sorry ' .$_POST['email'] . 'is already in use please try another';
               $registerprocess === false;
           }//else the email is not is use as fetchColumn is not &gt; 0 so the registration proceeds.
           else {$registerprocess === true;}
  
           // catch (PDOException $e){
           //die("Unable to run query: " . $e-&gt;getMessage());}
  
  
           if ($registerprocess === true) {       
                //username and email are not on record so i am free to INSERT data into database
                $query = "INSERT INTO registration_view (username, password, email, gender, date_of_birth, joindate)
                VALUES (?, ?, ?, ?, ?, ?)";
  
                $joindate = now();
                $date_of_birth = $_POST['day'] . $_POST['month'] . $_POST['year'];
  
                $stmt-&gt;prepare($query);
                $stmt-&gt;bindParam(1, $_POST['username'], PDO::PARAM_STR, 20) ;
                $stmt-&gt;bindParam(2, $_POST['password'], PDO::PARAM_STR, 20) ;
                $stmt-&gt;bindParam(3, $_POST['email'], PDO::PARAM_STR, 20) ;
                $stmt-&gt;bindParam(4, $_POST['gender']) ;
                $stmt-&gt;bindParam(5, $date_of_birth) ;
                $stmt-&gt;bindParam(6, $joindate) ;
  
                $stmt-&gt;execute();
  
                print ' Welcome ' .$username . 'you are now registered';
         }
      } catch (PDOException $e) {
          die("Unable to connect: " . $e-&gt;getMessage());
      }
  
  }//INPUT VALIDATION IF
  </code></pre>
  
  <p>This is my code, the first flag is to continue on once data validation has been successful that much has worked and the print 'validation'; confirms this.</p>
  
  <p>I'm sure that the $dsn is not in error as an error was displayed previously when it was wrapped in single quotes and now no such errors are being displayed.</p>
  
  <p>While i'm open to the code being a mess i've also been going through the php.ini my.ini and apache.config but as said no luck for a week.</p>
  
  <p>The only things i can add of any help (or at least maybe a lead) is some errors for the apache and php error logs.</p>
  
  <p>Apache displays this from when i try to run the script from local host.</p>
  
  <pre><code>[Mon Dec 29 12:49:13.855653 2014] [authz_core:error] [pid 3632:tid 964] [client ::1:49206] AH01630: client denied by server configuration: C:/Apache24, referer: http://localhost/theturnbuckle/
  </code></pre>
  
  <p>And php display this, although i have reinstalled the apche server since and before the installation i moved the php_intl.dll and phpldap.dll to another folder in wamp and these errors went away. (not even sure if that is the best practice) </p>
  
  <pre><code>[24-Dec-2014 12:00:37 UTC] PHP Warning:  PHP Startup: Unable to load dynamic library 'c:/wamp/bin/php/php5.5.12/ext/php_intl.dll' - The specified module could not be found.
  </code></pre>
  
  <p>in Unknown on line 0</p>
  
  <pre><code>[24-Dec-2014 12:00:37 UTC] PHP Warning:  PHP Startup: Unable to load dynamic library 'c:/wamp/bin/php/php5.5.12/ext/php_ldap.dll' - The specified module could not be found.
  </code></pre>
  
  <p>in Unknown on line 0</p>
  
  <p>I uncommented out some of the mysql server variables.</p>
  
  <pre><code>innodb_data_home_dir = C:\mysql\data/
  innodb_data_file_path = ibdata1:10M:autoextend
  innodb_log_group_home_dir = C:\mysql\data/
  innodb_log_arch_dir = C:\mysql\data/
  </code></pre>
  
  <p>And finally i checked out some php.ini server variables to try and help the situation, display errors is on.</p>
  
  <p>All php extensions seem to be installed such as php_pdo_mysql and php_mysqli.</p>
  
  <p>But at the end of the day i'm floundering in the dark.</p>