pc_db_analysis.php 1.0 KB

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. include "./config.php";
  3. include "./_pdo.php";
  4. $get_book=$_GET["book"];
  5. $boolList=str_getcsv($get_book,',');/*生成書名數組*/
  6. $countInsert=0;
  7. $wordlist=array();
  8. $db_file = _FILE_DB_RESRES_INDEX_;
  9. $bookstring="";
  10. for($i=0;$i<count($boolList);$i++)
  11. {
  12. $bookstring.="'".$boolList[$i]."'";
  13. if($i<count($boolList)-1){
  14. $bookstring.=",";
  15. }
  16. }
  17. //open database
  18. PDO_Connect("sqlite:$db_file");
  19. $query = "select count(*) from (SELECT count() FROM \"toc\" WHERE (book in (".$bookstring.") and author='PCDS') group by book,par_num ) T";/*查總數,并分類匯總*/
  20. $allpar=PDO_FetchOne($query);
  21. $query = "select count(*) from (SELECT count() FROM \"toc\" WHERE (book in (".$bookstring.") and author<>'PCDS') group by book,par_num ) T";/*查有譯文的段落,并分類匯總——已完成*/
  22. $finished=PDO_FetchOne($query);
  23. $persent=$finished/$allpar;
  24. print "总共:$allpar <br />已经完成:$finished <br />百分比:$persent";
  25. //$Fetch = PDO_FetchAll($query);
  26. //$iFetch=count($Fetch);
  27. /*查询结束*/
  28. ?>