Jump to content

PDO::Execute returning false


Andy-H

Recommended Posts

   private function _authenticate()
   {
      // if there's already an auth error
      if ( $this->_checkForMessageType('auth') )
      {
         $this->_addMessage('auth', 3);
         self::__destruct();
         return false;
      }
      $stmt = $this->_dbh->prepare("SELECT shopID FROM api_users WHERE shopID = ? AND API_key = ? LIMIT 1");
      
      var_dump($stmt->execute(array($this->_shopID, $this->_key)));
      echo $stmt->rowCount();
      // authenticate key / shop id
      if ( !$stmt->rowCount() )
      {
         $this->_addMessage('auth', 3);
         self::__destruct();
         return false;
      }
      $this->_addMessage('auth', 4);
   }

 

I am using PDO with MySQL driver and ATTR_EMULATE_PREPARES => true, however, when I run this code I get the output:

bool(false) 0{"auth":{"3":""}}

 

Any ideas why PDOStatement::execute is returning false? I get no connection errors, no PDOExceptions, the db structure is correct, and there is valid data in the database.

 

Any help appreciated, thanks.

Link to comment
https://forums.phpfreaks.com/topic/254710-pdoexecute-returning-false/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.