/[health_html]/inc/pgLinkovi.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

Diff of /inc/pgLinkovi.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by ravilov, Fri Sep 28 23:34:37 2001 UTC revision 1.2 by ravilov, Fri Oct 5 15:10:53 2001 UTC
# Line 1  Line 1 
1  <?php  <?php
2          $sql = "SELECT url, naslov, opis FROM linkovi ORDER BY naslov";          function myCmp($a, $b) { return MyCompare($a["naslov"], $b["naslov"]); }
3          $sth = $dbh->prepare($sql);          function myCmp2($a, $b) { return MyCompare($a["naziv"], $b["naziv"]); }
4          if (!$sth) error("Cannot prepare query: \"$sql\"");          $naslov = "";
5          if (!$sth->execute()) error("Cannot execute query: \"$sql\"");          if ($grupa) {
6          $linkovi = array();                  $sql = "SELECT opis FROM specijalizacije WHERE (link) AND (spec_id = $grupa)";
7          while ($row = $sth->fetchrow_array())                  $sth = $dbh->prepare($sql);
8                  array_push($linkovi, array("url" => MyEscape($row[0]), "naslov" => MyEscape($row[1]), "opis" => MyEscape($row[2])));                  if (!$sth) error("Cannot prepare query: \"$sql\"");
9          $sth->finish();                  if (!$sth->execute()) error("Cannot execute query: \"$sql\"");
10          $tpl->assign("linkovi", $linkovi);                  $row = $sth->fetchrow_array();
11                    $sth->finish();
12                    if ($row) $row = array_shift($row);
13                    if ($row) $naslov = $row;
14                    $sql = "SELECT url, naslov, opis FROM linkovi, link_spec".($spec?", link_spec":"")." WHERE (linkovi.link_id = link_spec.link_id) AND (link_spec.spec_id = $grupa)".($spec?" AND (link_spec.spec_id = $spec)":"");
15                    $sth = $dbh->prepare($sql);
16                    if (!$sth) error("Cannot prepare query: \"$sql\"");
17                    if (!$sth->execute()) error("Cannot execute query: \"$sql\"");
18                    $linkovi = array();
19                    while ($row = $sth->fetchrow_array())
20                            array_push($linkovi, array("url" => MyEscape($row[0]), "naslov" => MyEscape($row[1]), "opis" => MyEscape($row[2])));
21                    $sth->finish();
22                    usort($linkovi, "myCmp");
23                    $tpl->assign("linkovi", $linkovi);
24            } else {
25                    $sql = "SELECT spec_id, opis FROM specijalizacije WHERE (link)";
26                    $sth = $dbh->prepare($sql);
27                    if (!$sth) error("Cannot prepare query: \"$sql\"");
28                    if (!$sth->execute()) error("Cannot execute query: \"$sql\"");
29                    $grupe = array();
30                    while ($row = $sth->fetchrow_array())
31                            array_push($grupe, array("id" => $row[0], "naziv" => MyEscape($row[1])));
32                    $sth->finish();
33                    usort($grupe, "myCmp2");
34                    $tpl->assign("grupe", $grupe);
35            }
36            if ($spec) {
37                    $sql = "SELECT opis FROM specijalizacije WHERE spec_id = $spec";
38                    $sth = $dbh->prepare($sql);
39                    if (!$sth) error("Cannot prepare query: \"$sql\"");
40                    if (!$sth->execute()) error("Cannot execute query: \"$sql\"");
41                    $row = $sth->fetchrow_array();
42                    $sth->finish();
43                    if ($row) $row = array_shift($row);
44                    if ($row) {
45                            if ($naslov) $naslov .= " - ";
46                            $naslov .= $row;
47                    }
48            }
49            $tpl->assign("grupa", $grupa);
50            $tpl->assign("naslov", $naslov);
51            $dbh->disconnect();
52  ?>  ?>

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

  ViewVC Help
Powered by ViewVC 1.1.26