comparison Keyword.class.php @ 130:290a05fd7331

mod: 半角英数で検索しても全角英数がヒットするように変更
author Sushi-k <epgrec@park.mda.or.jp>
date Thu, 18 Mar 2010 17:50:01 +0900
parents 7a64d5e3baee
children 9c5e597ef6c6
comparison
equal deleted inserted replaced
129:1e93ea03ebd9 130:290a05fd7331
34 if( $keyword != "" ) { 34 if( $keyword != "" ) {
35 if( $use_regexp ) { 35 if( $use_regexp ) {
36 $options .= " AND CONCAT(title,description) REGEXP '".mysql_real_escape_string($keyword)."'"; 36 $options .= " AND CONCAT(title,description) REGEXP '".mysql_real_escape_string($keyword)."'";
37 } 37 }
38 else { 38 else {
39 $options .= " AND CONCAT(title,description) like '%".mysql_real_escape_string($keyword)."%'"; 39 // 茹茹
40 // 翫絲上
41 $f_zennum = preg_match('/[0-9]/u', $keyword );
42 $f_zenal = preg_match('/[a-zA-Z]/u', $keyword );
43
44 $options .= " AND ( CONCAT(title,' ',description) like '%".mysql_real_escape_string($keyword)."%'";
45
46 if( $f_zennum ) {
47 $options .= " OR CONCAT(title,' ',description) like '%".mysql_real_escape_string(mb_convert_kana( $keyword, 'KVN' ))."%'";
48 }
49 if( $f_zenal ) {
50 $options .= " OR CONCAT(title,' ',description) like '%".mysql_real_escape_string(mb_convert_kana( $keyword, 'KVR' ))."%'";
51 }
52 if( $f_zenal && $f_zennum ) {
53 $options .= " OR CONCAT(title,' ',description) like '%".mysql_real_escape_string(mb_convert_kana( $keyword, 'KVRN' ))."%'";
54 }
55 $options .= ") ";
40 } 56 }
41 } 57 }
42 58
43 if( $type != "*" ) { 59 if( $type != "*" ) {
44 $options .= " AND type = '".$type."'"; 60 $options .= " AND type = '".$type."'";