title: php pdo success but dont enter the data to the database
body: <p>I have this weird issue with my PDO/SQL. I use namespaces and classes to control things.</p>
  
  <p>I use a custom PDO class which is because I also define some standard values like PDO should throw exceptions and so.</p>
  
  <p>The weird issue appears when I try to create a user. I'm in the development stage on this project thereby I'm hardcoding a test login.</p>
  
  <pre><code>try  
  {  
  $user = new OOP\User\user();  
  $user-&gt;setFirstname("Firstname");  
  $user-&gt;setLastname("Lastname");  
  $user-&gt;setUsername("Test");  
  $user-&gt;setSecret(OOP\utillityClass::create_unique_hash(128));  
  $user-&gt;setPassword(OOP\utillityClass::create_password("*Duh as if im studpid enought to post my password*", $user-&gt;getSecret()));  
  $user-&gt;setEmail("some mail");  
  $birthday = new DateTime("1990-01-01");  
  $user-&gt;setBirthday($birthday);  
  $user-&gt;setClass(1);  
  $user-&gt;setAdded(new DateTime());  
  $user-&gt;setLast_Active(new DateTime());  
  $user-&gt;setActivated(true);  
  $user-&gt;setIp(OOP\utillityClass::getip());  
  $user-&gt;setIv(OOP\Crypt\crypt::createIv("hex"));  
  $permissions = array();  
  $permissions['staff'] = array();  
  $permissions['staff']['read'] = 1;  
  $user-&gt;setPermissions(json_encode($permissions));  
  $user-&gt;save();  
  }  
  catch (Exception $e)  
  {  
  echo "Error *censored, i use slurs while debugging*:" . PHP_EOL;  
  print_r($e);  
  }
  </code></pre>
  
  <p>The above is the creation code.</p>
  
  <p>This is the table in the database:</p>
  
  <pre><code>CREATE TABLE IF NOT EXISTS `user` (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `firstname` varchar(50) NOT NULL,
    `lastname` varchar(50) NOT NULL,
    `username` varchar(50) NOT NULL,
    `password` varchar(128) NOT NULL,
    `secret` varchar(128) NOT NULL,
    `email` varchar(255) NOT NULL,
    `birthday` date NOT NULL,
    `class` int(11) NOT NULL,
    `added` datetime NOT NULL,
    `last_active` datetime NOT NULL,
    `activated` tinyint(1) NOT NULL DEFAULT '0',
    `ip` varchar(40) NOT NULL,
    `iv` varchar(32) NOT NULL,
    `permissions` text NOT NULL,
    PRIMARY KEY (`id`),
    UNIQUE KEY `username` (`username`)
  ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;
  </code></pre>
  
  <p>And here comes the insert code (note that it is the public save method that is called, but the save method call this private method since there is no user loaded, then it creates it):</p>
  
  <pre><code>private function insert()
  {
  
      // We need the $CONFIG variable for sending actiovation emails \\
      global $CONFIG;
  
      $q = $this-&gt;PDO-&gt;prepare("INSERT INTO `user` (`firstname`, `lastname`, `username`, `password`, `secret`, `email`, `birthday`, `class`, `added`, `last_active`, `activated`, `ip`, `iv`, `permissions`) VALUES (:firstname, :lastname, :username, :password, :secret, :email, :birthday, :class, :added, :last_active, :activated, :ip, :iv, :permissions);");
  
  
      $q-&gt;bindParam(':firstname', $this-&gt;firstname);
      $q-&gt;bindParam(':lastname', $this-&gt;lastname);
      $q-&gt;bindParam(':username', $this-&gt;username);
      $q-&gt;bindParam(':password', $this-&gt;password);
      $q-&gt;bindParam(':secret', $this-&gt;secret);
      $q-&gt;bindParam(':email', $this-&gt;email);
      $q-&gt;bindParam(':birthday', $this-&gt;birthday-&gt;format("Y-m-d"));
      $q-&gt;bindParam(':class', $this-&gt;class);
      $q-&gt;bindParam(':added', $this-&gt;added-&gt;format("Y-m-d H:i:s"));
      $q-&gt;bindParam(':last_active', $this-&gt;last_active-&gt;format("Y-m-d H:i:s"));
      $q-&gt;bindParam(':activated', $this-&gt;activated);
      $q-&gt;bindParam(':ip', $this-&gt;ip);
      $q-&gt;bindParam(':iv', $this-&gt;iv);
      $q-&gt;bindParam(':permissions', $this-&gt;permissions);
  
      $res = $q-&gt;execute();
  
      if ($q-&gt;errorCode() != 00000)
      {
          throw new \Exception("An error occured during the creation");
      }
      else
      {
          return true;
      }
  
  }
  </code></pre>
  
  <p>Now here comes the fun thing, there is no Exception or PDOException's at all, actually it passes as it should but it does not enter the data into the database, but the auto increment number increase by 1.</p>
  
  <p>I really hope someone can help me out with this one since I've been trying to get this to work all day long, and I've tried to drop and recreate the database and tables, including the insert code.</p>
  
  <p>On beforehand, thank you very much for your time and help.</p>