function auto_complete_category($category, $val, $result_limit = '5', $format = 'ac_line', &$match_count = '') { $dbr =& wfGetDB(DB_SLAVE); //do value pre-proccessing if bill type: if ($category == 'Bill') { $val = MV_SpecialMediaSearch::bill_formater($val); } $result = $dbr->select('categorylinks', 'cl_sortkey', array('cl_to' => $category, '`cl_sortkey` LIKE \'%' . mysql_escape_string($val) . '%\' COLLATE latin1_swedish_ci'), __METHOD__, array('LIMIT' => $result_limit)); // print 'ran: ' . $dbr->lastQuery(); // mention_bill catebory Bill $match_count = $dbr->numRows($result); if ($dbr->numRows($result) == 0) { return ''; } $out = ''; while ($row = $dbr->fetchObject($result)) { $out .= MV_SpecialMediaSearch::format_ac_line($row->cl_sortkey, $val, '', 'no_image', $format); } return $out; }