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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.