pc_get_res_list.php 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php
  2. $get_book = $_GET["book"];
  3. $get_par_list = $_GET["par_list"];
  4. $get_res_type = $_GET["res_type"];
  5. include "./config.php";
  6. include "./_pdo.php";
  7. $countInsert = 0;
  8. $parList = str_getcsv($get_par_list, ',');
  9. $parstring = "";
  10. for ($i = 0; $i < count($parList); $i++) {
  11. $parstring .= "'" . $parList[$i] . "'";
  12. if ($i < count($parList) - 1) {
  13. $parstring .= ",";
  14. }
  15. }
  16. $outXml = "<index>";
  17. echo $outXml;
  18. switch ($get_res_type) {
  19. case "translate":
  20. $tableName = "data";
  21. break;
  22. case "wbw":
  23. $tableName = "main";
  24. break;
  25. }
  26. $db_file = "../appdata/palicanon/" . $get_res_type . "/" . $get_book . "_" . $get_res_type . ".db3";
  27. //open database
  28. PDO_Connect("$db_file");
  29. //for($iPar=0;$iPar<count($parList);$iPar++)
  30. {
  31. //$query = "select * FROM ".$tableName." where \"paragraph\"=".$PDO->quote($parList[$iPar]);
  32. $query = "select * FROM " . $tableName . " where paragraph in (" . $parstring . ")";
  33. $Fetch = PDO_FetchAll($query);
  34. $iFetch = count($Fetch);
  35. if ($iFetch > 0) {
  36. for ($i = 0; $i < $iFetch; $i++) {
  37. $outXml = "<res>";
  38. $outXml = $outXml . "<book>$get_book</book>";
  39. $outXml = $outXml . "<par>" . $Fetch[$i]["paragraph"] . "</par>";
  40. $outXml = $outXml . "<type>$get_res_type</type>";
  41. $outXml = $outXml . "<language>" . $Fetch[$i]["language"] . "</language>";
  42. $outXml = $outXml . "<author>" . $Fetch[$i]["author"] . "</author>";
  43. $outXml = $outXml . "<editor>" . $Fetch[$i]["editor"] . "</editor>";
  44. $outXml = $outXml . "<revision>" . $Fetch[$i]["revision"] . "</revision>";
  45. $outXml = $outXml . "<edition>" . $Fetch[$i]["edition"] . "</edition>";
  46. $outXml = $outXml . "<subver>" . $Fetch[$i]["subver"] . "</subver>";
  47. switch ($get_res_type) {
  48. case "translate":
  49. $outXml = $outXml . "<text>" . $Fetch[$i]["toc"] . "</text>";
  50. break;
  51. }
  52. $outXml = $outXml . "</res>";
  53. echo $outXml;
  54. }
  55. }
  56. }
  57. /*查询结束*/
  58. $outXml = "</index>";
  59. echo $outXml;