2010-03-16 4 views

답변

1

당신이 MySQL을 사용하는 경우

CHAR_LENGTH (STR) 문자로 측정 str 문자열의 길이를 돌려줍니다. 멀티 바이트 문자는 단일 문자로 간주됩니다. 이는 그 다섯 2 바이트 문자 길이를() CHAR_LENGTH()가

5. 그래서 당신은

where(char_length(terms) > 4)) 
+0

이를 plussing 추가 반환하는 반면 처음이었고, I로, 10을 반환 포함 된 문자열 길이를 char_length와 혼합했다. – Gordon

2

:

function sm_list_recent_searches($before = '', $after = '', $count = 20) { 
// List the most recent successful searches. 
    global $wpdb, $table_prefix; 
    $count = intval($count); 
    $results = $wpdb->get_results(
     "SELECT `terms`, `datetime` 
     FROM `{$table_prefix}searchmeter_recent` 
     WHERE 100 < `hits` 
     ORDER BY `datetime` DESC 
     LIMIT $count"); 
    if (count($results)) { 

     foreach ($results as $result) { 
      echo '<a href="'. get_settings('home') . '/search/' . urlencode($result->terms) . '">'. htmlspecialchars($result->terms) .'</a>'.", "; 
     } 

    } 
} 
관련 문제