12345678910111213141516171819202122232425262728 |
- <?php
- include 'con.php';
- //error handling
- ini_set('display_errors', 1);
- error_reporting(E_ALL);
- //variables from centurio
- $toolID = $_POST["toolID"];
- //db
- $sql = "SELECT * FROM (SELECT * FROM DTC_TOOL_LC_EVENT WHERE TOOL_ID = '{$toolID}' ORDER BY DATE_TIME DESC) WHERE ROWNUM <= 5";
- $res = sqlStm($sql);
- $article = $res["ARTICLE_ID"];
- if (!array_filter($article)) {
- $newsql = "SELECT * FROM (SELECT * FROM DTC_TOOL_LC_EVENT WHERE TOOL_ID = '{$toolID}' AND ARTICLE_ID IS NOT NULL ORDER BY DATE_TIME DESC ) WHERE ROWNUM <= 1";
- $res2 = sqlStm($newsql);
- $lastArticle = $res2["ARTICLE_ID"][0];
- } else {
- $last = array_filter($article);
- $lastArticle = end($last);
- }
- $eventList = json_encode($res);
- $sqlAc = "SELECT NAME_DE FROM DTC_TOOLPART";
- $toolPart = json_encode(sqlStm($sqlAc)["NAME_DE"]);
- //to centurio
- header('Content-Type:application/json');
- echo json_encode( array("eventList" => $eventList, "lastArticle" => $lastArticle, "toolPart" => $toolPart));
- ?>
|