php - PDO MySQL get records with previous date -


i've got table columns. want filter records using 2 of them, 1 int type , second datetime type. i'm using php pdo extension connect database , make queries.

i'm trying records table datetime field lower given date, f.e.

<?php     $date = date("y-m-d");     $this->db->query("select * `" . db_prefix . "fanpage` `flag_warning` = ? , date(`update_date`) < ?", array(1, $date)); ?> 

this returns null, when paste same query phpmyadmin window shows me proper records. problem?

edit:

fragment query function:

public function query($sql, $params = array()) {     $result = array();     $result['query'] = $this->pdo->prepare($sql);     $result['query']->execute($params);     $this->lastresult = $result['query'];     unset($result['query']); } 

no need prepared statements @ all

where flag_warning = 1 , update_date < curdate() 

Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -