quote($para)." ) ";
$sth = $PDO->prepare($query);
$sth->execute();
$palitext="";
while($result = $sth->fetch(PDO::FETCH_ASSOC))
{
$index = str_getcsv($result["wid"],"-")[2];
if($index>=$begin && $index<=$end){
if($result["type"]!=".ctl."){
$paliword=$result["word"];
if($result["style"]=="bld"){
if(strchr($result["word"],"{")!=FALSE && strchr($result["word"],"}")!=FALSE ){
$paliword = str_replace("{","",$paliword);
$paliword = str_replace("}","",$paliword);
}
else{
$paliword = "{$paliword}";
}
}
$palitext .= $paliword." ";
}
}
}
$para_path=_get_para_path($bookId,$para);
//find out translation
$db_file=_FILE_DB_SENTENCE_;
PDO_Connect("sqlite:$db_file");
$query="select * from sentence where book='{$bookId}' and paragraph='{$para}' and begin='{$begin}' and end='{$end}' ";
$Fetch = PDO_FetchAll($query);
$iFetch=count($Fetch);
if($iFetch>0){
$tran = $Fetch[0]["text"];
}
else{
$tran="";
}
$output=array("id"=>$id,"palitext"=>$palitext,"tran"=>$tran,"ref"=>$para_path);
echo json_encode($output, JSON_UNESCAPED_UNICODE);