处理where子句
<?php 

function b_parse($str$field)  

   if(
$str) {  
   
$quoted explode"\""$str); 
             
   for(
$i 0$i count($quoted); $i++) { 
      if(
$i == && !$quoted[$i]) { 
       
//quote came at beginning of string 
      
$begin True
      
$i++; 
      } 
      if(
$begin) { $words[] = $quoted[$i]; } 
      else { 
         
$phrase explode" "$quoted[$i]); 
         for(
$n 0$n count($phrase); $n++) { 
            if(
$phrase[$n]) { $words[] = $phrase[$n]; } 
         } 
      } 
      
$begin = !$begin
   }             
             
   for(
$i 0$i count($words); $i++) { 
      if(
$words[$i]) { 
         if(
$words[$i] ==  "and" || $words[$i] ==  "or" || $words[$i] ==  "not") { 
            if(
$words[$i] ==  "not") { 
               
$i++; 
               if(
$sql_out) { $sql_out .=  " AND "; } 
               
$sql_out .= $field .  " NOT LIKE '%" $words[$i] .  "%'"
             } 
             else if(
$i 0) { 
               
$sql_out .=  " " strtoupper($words[$i]) .  " "
               
$boolean True
             } 
          } 
          else { 
            if(
$sql_out && !$boolean) { $sql_out .=  " OR "; } 
            
$sql_out .= $field .  " LIKE '%" $words[$i] .  "%'"
            
$boolean False
          } 
      } 
    } 
    } 
    return 
$sql_out


?>