Im trying to get a hold of OOP and PDO. Did some tutorials. In the tutorial i got the query method (so thats not mine...)
but im having troubles with a pdo query
I want to select orders from the database matching a date..... de date comes from a datepicker and returns 2012-12-16 for example therefor
$dateInputQuery = date("Y-m-d", strtotime(Input::get('datepick')));
$data = $order->getAllOrders('order', 'WHERE DATE(orderdate) = DATE({$dateInputQuery})', false, false);
the strange thing is that when i replace the WHERE clause to WHERE DATE(orderdate) = \'2013-12-16\' it returns all the data but when inserting my date like above it does not....
in the db class the method looks like this
public function getAll($table, $where = NULL, $orderSort = NULL, $limit = NULL) {
    $this->query("SELECT * FROM {$table} {$where} {$orderSort} {$limit}")->error();
    return $this;
}
and query method in db class
public function query($sql, $params = array()) {
    //reset error
    $this->_error = false;
    if ($this->_query = $this->_pdo->prepare($sql)) {
        $x = 1;
        if (count($params)) {
            foreach ($params as $param) {
                $this->_query->bindValue($x,$param);
                $x++;
            }
        }
        if ($this->_query->execute()) {
            $this->_results = $this->_query->fetchAll(PDO::FETCH_OBJ);
            $this->_count = $this->_query->rowCount();
        } else {
            $this->_error = true;
        }
    }
    return $this;
}
why is this ?