Andy-H Posted January 10, 2012 Share Posted January 10, 2012 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. Quote Link to comment https://forums.phpfreaks.com/topic/254710-pdoexecute-returning-false/ Share on other sites More sharing options...
Andy-H Posted January 10, 2012 Author Share Posted January 10, 2012 Solved, forgot the 'dbname=' in the constructor lol Quote Link to comment https://forums.phpfreaks.com/topic/254710-pdoexecute-returning-false/#findComment-1306048 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.