當前位置: 首頁>>代碼示例>>PHP>>正文


PHP DbUtils::getDbr方法代碼示例

本文整理匯總了PHP中DbUtils::getDbr方法的典型用法代碼示例。如果您正苦於以下問題:PHP DbUtils::getDbr方法的具體用法?PHP DbUtils::getDbr怎麽用?PHP DbUtils::getDbr使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在DbUtils的用法示例。


在下文中一共展示了DbUtils::getDbr方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getTitles

 public static function getTitles($seedKeyword, $groupTitles)
 {
     if (empty($seedKeyword)) {
         return;
     }
     $dbr = DbUtils::getDbr();
     $query = "SELECT\n\t\t\tgroup_concat(DISTINCT t.short_title SEPARATOR 0x0B) as short_titles,\n\t\t\tgroup_concat(DISTINCT IF (t.wh_aid <> 0, concat('http://www.wikihow.com/',t.wh_title), '') SEPARATOR 0x0B) as wh_article,\n\t\t\tsum(k.avg_month_searches) as sum_of_ams,\n\t\t\tcount(t.short_title) as num_sites\n\t\tFROM\n\t\t\tleonard.leo_keywords k INNER join leonard.leo_titles t ON k.keyword = t.keyword\n\t\tWHERE\n\t\t\tk.status = 'A'\n\t\t\tAND t.status = 'A'\n\t\t\tAND k.seed = " . $dbr->addQuotes($seedKeyword) . " \n" . "GROUP BY ";
     //		Also had following columns in the select query however elizabeth needs only few as seen in the actual query
     // 		group_concat(DISTINCT t.site order by t.position_in_results SEPARATOR 0x0B) as site_list,
     // 		group_concat(DISTINCT concat(t.keyword,':',k.avg_month_searches) ORDER BY k.avg_month_searches DESC) as kwd_n_avg_m_searches,
     // 		group_concat(t.original_title order by t.position_in_results SEPARATOR 0x0B) as original_titles,
     // 		group_concat(DISTINCT t.url SEPARATOR 0x0B) as urls,
     // 		min(k.ip_rank) as min_kw_ip_rank,
     // 		max(k.ip_rank) as max_kw_ip_rank
     if ($groupTitles === true) {
         $query .= " dup_grp_id ";
     } else {
         $query .= " short_title ";
     }
     $query .= " ORDER BY\n\t\t\tsum(k.avg_month_searches) DESC,\n\t\t\tt.keyword,\n\t\t\tcount(t.short_title) DESC";
     $dbr = DbUtils::getDbr();
     return DbUtils::exDbR($query);
 }
開發者ID:biribogos,項目名稱:wikihow-src,代碼行數:23,代碼來源:LDao.php


注:本文中的DbUtils::getDbr方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。