0

I am trying to do a query onto my database with the following code.

public function getFreeFields($date){
        print_r($date);
        $db = Zend_Registry::get('db');
    $select = $db->select()
        ->from(array('f' => $this->_tablename()), array('f.fie_id','f.fie_name'))
                    ->join('reservation','reservation.res_field = f.fie_id')
                    ->where('reservation.res_date_from > ?'. $date)
                    ->where('reservation.res_date_till < ?'. $date);

    $result = $db->fetchRow($select);
    $data = $this->_mapper->toObject( is_array($result) ? $result : array() );

    return $data;
    }

But it crashes with the following error.

Uncaught exception 'PDOException' with message 'SQLSTATE[HY093]: Invalid parameter number: no parameters were bound'

When I die after the print_r, I got the correct date that I give to the request.

Any help?

0

1 Answer 1

2

change this

->where('r.res_date_from > ?'. $date)
->where('r.res_date_till < ?'. $date);

to

->where('r.res_date_from > ?', $date)
->where('r.res_date_till < ?', $date);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.