Zend\Validator\Db\AbstractDb.php and mysqli #3656

Closed
katalonec opened this Issue Feb 2, 2013 · 1 comment

Comments

Projects
None yet
4 participants
protected function query($value)
    {
        $adapter  = $this->getAdapter();
        $statement = $adapter->createStatement();
        $this->getSelect()->prepareStatement($adapter, $statement);

        return $statement->execute(array('value' => $value))->current();
    }

produces Warning: mysqli_stmt::bind_param(): Number of variables doesn't match number of parameters in prepared statement

This solves issue:

protected function query($value)
    {
        $adapter  = $this->getAdapter();
        $statement = $adapter->createStatement();
        $this->getSelect()->prepareStatement($adapter, $statement);

        $key = $statement->getParameterContainer()->key();
        return $statement->execute(array($key => $value))->current();
    }
Member

Maks3w commented Feb 2, 2013

Please send a pull request with your fix and a test case

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment