English 中文(简体)
php s mysql_query function hadn t support more LIKE statament?
原标题:php s mysql_query function didn t support more LIKE statament?
  • 时间:2010-07-27 18:36:13
  •  标签:
  • php
  • mysql

问:

select * 
  from marrydays 
 where YMD_X like  2010-1-%  
   and marrydays.CONG not like  aa%  
   and marrydays.CONG not like  bb%  ;

但是,在我使用我的sql_fetch_object功能之后, 我没有得出确切的结果,结果就象我问的那样:

select * from marrydays where YMD_X like  2010-1-%  ;

为什么?


一些法典:

1美元=db->find("select * from marriagesdays where YMD_X as.” “.$cnD% and CONG not similar ́$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;
}
问题回答

由于PHP的舱面功能只是像你所写的那样把事情转嫁给MySQL,你是sure,直接在MySQL上处理同样的问题,结果不同?

这里的问题几乎肯定在于你。





相关问题
SQL SubQuery getting particular column

I noticed that there were some threads with similar questions, and I did look through them but did not really get a convincing answer. Here s my question: The subquery below returns a Table with 3 ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

php return a specific row from query

Is it possible in php to return a specific row of data from a mysql query? None of the fetch statements that I ve found return a 2 dimensional array to access specific rows. I want to be able to ...

Character Encodings in PHP and MySQL

Our website was developed with a meta tag set to... <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> This works fine for M-dashes and special quotes, etc. However, I ...

Pagination Strategies for Complex (slow) Datasets

What are some of the strategies being used for pagination of data sets that involve complex queries? count(*) takes ~1.5 sec so we don t want to hit the DB for every page view. Currently there are ~...

Averaging a total in mySQL

My table looks like person_id | car_id | miles ------------------------------ 1 | 1 | 100 1 | 2 | 200 2 | 3 | 1000 2 | 4 | 500 I need to ...

热门标签