php 's mysql_query function didn't support more LIKE statament?
I queried:
select *
from marrydays
where YMD_X like '2010-1-%'
and marrydays.CONG not like 'aa%'
and marrydays.CONG not like 'bb%' ;
But after I use mysql_fetch_object function,I didn't got exact result,the result just like I queried :
select * from marrydays where YMD_X like '2010-1-%' ;
Why?
Some code pieces:
$res1 = $db->find("select * from marrydays where YMD_X like"." '".$cnDate."%' and CONG not like '冲".$male_shu."%' ;");
public function find($sql, $key=null){ $data = array(); $result = $this->query(开发者_运维技巧$sql); while($row = mysql_fetch_object($result)){ if(!empty($key)){ $data[$row->{$key}] = $row; }else{ $data[] = $row; } } return $data; }
public function query($sql){
$stime = microtime(true);
$result = mysql_query($sql, $this->conn);
$this->query_count ++;
if($result === false){
throw new Exception(mysql_error($this->conn)." in SQL: $sql");
}
$etime = microtime(true);
$time = number_format(($etime - $stime) * 1000, 2);
$this->query_list[] = $time . ' ' . $sql;
return $result;
}
Since PHP's mysql_query function just passes things to MySQL as you wrote them, are you sure that running the same query directly on MySQL gives a different result?
The problem here almost certainly lies with your query.
精彩评论