0
我似乎無法將Wilson Score Confidence SQL代碼翻譯成Codeigniter活動記錄代碼。下面是威爾遜評分置信普通的SQL:翻譯威爾遜比分信心SQL代碼Codeigniter活躍記錄
SELECT *, ((likes+ 1.9208)/(likes + dislikes) -
1.96 * SQRT((likes * dislikes)/(likes + dislikes) + 0.9604)/
(likes + dislikes))/(1 + 3.8416/(likes + dislikes))
AS ci_lower_bound FROM widgets WHERE likes + dislikes > 0
ORDER BY ci_lower_bound DESC;
這是摘自:http://www.evanmiller.org/how-not-to-sort-by-average-rating.html
這裏是我嘗試翻譯這似乎不工作:
$this->db->select('*, ((likes + 1.9208)/(likes + dislikes) - 1.96 * SQRT((likes * dislikes)/(likes + dislikes) + 0.9604)/(likes + dislikes))/(1 + 3.8416/(likes + dislikes)) AS ci_lower_bound');
$this->db->where('likes + dislikes >', 0);
$this->db->order_by("ci_lower_bound", "desc");
$query = $this->db->get('posts', $config['per_page'], $this->uri->segment(1));
$data['results'] = $query->result();
結果最終總是空的。