pc_db_analysis.php 1.0 KB

123456789101112131415161718192021222324252627282930
  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. $bookstring = "";
  9. for ($i = 0; $i < count($boolList); $i++) {
  10. $bookstring .= "'" . $boolList[$i] . "'";
  11. if ($i < count($boolList) - 1) {
  12. $bookstring .= ",";
  13. }
  14. }
  15. //open database
  16. PDO_Connect(_FILE_DB_RESRES_INDEX_);
  17. $query = "select count(*) from (SELECT count() FROM \"toc\" WHERE (book in (" . $bookstring . ") and author='PCDS') group by book,par_num ) T"; /*查總數,并分類匯總*/
  18. $allpar = PDO_FetchOne($query);
  19. $query = "select count(*) from (SELECT count() FROM \"toc\" WHERE (book in (" . $bookstring . ") and author<>'PCDS') group by book,par_num ) T"; /*查有譯文的段落,并分類匯總——已完成*/
  20. $finished = PDO_FetchOne($query);
  21. $persent = $finished / $allpar;
  22. print "总共:$allpar <br />{$_local->gui->finished}:$finished <br />百分比:$persent";
  23. //$Fetch = PDO_FetchAll($query);
  24. //$iFetch=count($Fetch);
  25. /*查询结束*/