/[health_html]/inc/pgKnjiznica-interakcije.php
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Annotation of /inc/pgKnjiznica-interakcije.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (hide annotations)
Wed Sep 26 13:04:28 2001 UTC (18 years ago) by ravilov
Branch: MAIN
CVS Tags: HEAD
Changes since 1.2: +1 -1 lines
Added some missing files, and some missing features...

1 ravilov 1.1 <?php
2 ravilov 1.2 include("inc/conn.php");
3 ravilov 1.1 function MyCmp1($a, $b) { return MyCompare($a["naziv"], $b["naziv"]); }
4     function MyCmp2($a, $b) { return MyCompare($a["lijek"], $b["lijek"]); }
5     $sql = "SELECT lijek_id, naziv FROM lijekovi2";
6     $sth = $dbh->prepare($sql);
7     if (!$sth) error("Cannot prepare query: \"$sql\"");
8     if (!$sth->execute()) error("Cannot execute query: \"$sql\"");
9     $lijekovi = array();
10     while ($row = $sth->fetchrow_array()) {
11     list($id, $naz) = $row;
12     array_push($lijekovi, array(
13     "id" => $id,
14     "naziv" => MyEscape($naz)
15     ));
16     }
17     usort($lijekovi, "MyCmp1");
18     $tpl->assign("lijek1", $lijek1);
19     $tpl->assign("lijek2", $lijek2);
20     $tpl->assign("lijekovi", $lijekovi);
21     $sth->finish();
22     if ($go || $print) {
23     $inter = array();
24     $sql = "SELECT lijek_id, naziv, opis, preporuka FROM lijekovi2";
25     if ($lijek1) $sql .= " WHERE (lijek_id = $lijek1)";
26     $sth = $dbh->prepare($sql);
27     if (!$sth) error("Cannot prepare query: \"$sql\"");
28     if (!$sth->execute()) error("Cannot execute query: \"$sql\"");
29     while ($row = $sth->fetchrow_array()) {
30     list($id, $naz, $op, $prep) = $row;
31     $sql = "SELECT lijekovi2.naziv, interakcije.predvid, predvidljivost.opis, interakcije.opis2 FROM interakcije, lijekovi2, predvidljivost WHERE (interakcije.lijek1_id = $id) AND (lijekovi2.lijek_id = interakcije.lijek2_id) AND (predvidljivost.pred_id = interakcije.predvid)";
32     if ($lijek2) $sql .= " AND (lijek2_id = $lijek2)";
33     $sth2 = $dbh->prepare($sql);
34     if (!$sth2) error("Cannot prepare query: \"$sql\"");
35     if (!$sth2->execute()) error("Cannot execute query: \"$sql\"");
36     $li2 = array();
37     while ($row2 = $sth2->fetchrow_array()) {
38     list($naz2, $pred, $pred2, $op2) = $row2;
39     array_push($li2, array(
40     "naziv" => MyEscape($naz2),
41     "predvid" => MyEscape($pred),
42     "pred2" => MyEscape($pred2),
43     "opis" => MyEscape($op2)
44     ));
45     }
46     $sth2->finish();
47     usort($li2, "MyCmp1");
48     array_push($inter, array(
49     "id" => $id,
50     "lijek" => MyEscape($naz),
51     "opis" => MyEscape($op),
52     "lijek2" => $li2,
53     "preporuka" => MyEscape($prep)
54     ));
55     }
56     $sth->finish();
57     usort($inter, "MyCmp2");
58     $tp = new Smarty();
59     $tp->assign("inter", $inter);
60     $table = $tp->fetch("interakcije.tpl");
61     $tpl->assign("CONTENT", $table);
62     if (!$print) {
63     include_once("print.php");
64     $tpl->assign("PRINT", GetPrint(array("lijek1", "lijek2")));
65     } else $main_template = "wrapper.tpl";
66     }
67 ravilov 1.3 $tpl->assign("FORM_ACTION", HTMLSpecialChars("?section=$section&section_menu=$section_menu"));
68 ravilov 1.1 ?>

  ViewVC Help
Powered by ViewVC 1.1.26