0){
$booktypesum["vinaya"]=array(0,0);
$booktypesum["sutta"]=array(0,0);
$booktypesum["abhidhamma"]=array(0,0);
$booktypesum["anna"]=array(0,0);
$booktypesum["mula"]=array(0,0);
$booktypesum["atthakattha"]=array(0,0);
$booktypesum["tika"]=array(0,0);
$booktypesum["anna2"]=array(0,0);
for($i=0;$i<$iFetch;$i++){
$book=$Fetch[$i]["book"];
$sum=$Fetch[$i]["co"];
array_push($newBookList,array($book,$sum));
$t1=$arrBookType[$book-1]->c1;
$t2=$arrBookType[$book-1]->c2;
if(isset($booktypesum[$t1])){
$booktypesum[$t1][0]++;
$booktypesum[$t1][1]+=$sum;
}
else{
$booktypesum[$t1][0]=1;
$booktypesum[$t1][1]=$sum;
}
if(isset($booktypesum[$t2])){
$booktypesum[$t2][0]++;
$booktypesum[$t2][1]+=$sum;
}
else{
$booktypesum[$t2][0]=1;
$booktypesum[$t2][1]=$sum;
}
}
echo "
";
}
return($newBookList);
//查找这些词出现在哪些书中结束
}
function countWordInPali($word,$sort=false,$limit = 0){
//加语尾
$case = $GLOBALS['case'];
$union = $GLOBALS['union'];
$arrNewWord=array();
for ($row = 0; $row < count($case); $row++) {
$len=mb_strlen($case[$row][0],"UTF-8");
$end=mb_substr($word, 0-$len,NULL,"UTF-8");
if($end==$case[$row][0]){
$newWord=mb_substr($word, 0,mb_strlen($word,"UTF-8")-$len,"UTF-8").$case[$row][1];
$arrNewWord[$newWord]=1;
}
}
//加连读词尾
$arrUnWord=array();
for ($row = 0; $row < count($union); $row++) {
$len=mb_strlen($union[$row][0],"UTF-8");
foreach($arrNewWord as $x=>$x_value){
$end=mb_substr($x, 0-$len,NULL,"UTF-8");
if($end==$union[$row][0]){
$newWord=mb_substr($x, 0,mb_strlen($x,"UTF-8")-$len,"UTF-8").$union[$row][1];
$arrUnWord[$newWord]=1;
}
}
}
//将连读词和$arrNewWord混合
foreach($arrUnWord as $x=>$x_value){
$arrNewWord[$x]=1;
}
if(count($arrNewWord)>0){
$strQueryWord="(";
foreach($arrNewWord as $x=>$x_value) {
$strQueryWord.="'{$x}',";
}
$strQueryWord=mb_substr($strQueryWord, 0,mb_strlen($strQueryWord,"UTF-8")-1,"UTF-8");
$strQueryWord.=")";
}
else{
$strQueryWord="('{$word}')";
}
//查找实际出现的拼写
$dsn = "sqlite:"._FILE_DB_WORD_INDEX_;
$user = "";
$password = "";
$PDO = new PDO($dsn, $user, $password,array(PDO::ATTR_PERSISTENT=>true));
$PDO->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
if($limit==0){
$sSqlLimit = "";
}
else{
$sSqlLimit = "limit 0 , ".$limit;
}
if($sort){
$sSqlSort = "order by count DESC";
}
else{
$sSqlSort = "";
}
$query = "select id,word,count,bold,len from wordindex where \"word\" in $strQueryWord ".$sSqlSort . " ".$sSqlLimit;
$stmt = $PDO->query($query);
$arrRealWordList = $stmt->fetchAll(PDO::FETCH_ASSOC);
return($arrRealWordList);
}
?>