/[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

Contents of /inc/pgLinkovi.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations)
Fri Oct 5 15:10:53 2001 UTC (22 years, 6 months ago) by ravilov
Branch: MAIN
Changes since 1.1: +50 -9 lines
Enhanced Linkovi on PLIVAmed.net and Arhiva. More bugfixes.

1 <?php
2 function myCmp($a, $b) { return MyCompare($a["naslov"], $b["naslov"]); }
3 function myCmp2($a, $b) { return MyCompare($a["naziv"], $b["naziv"]); }
4 $naslov = "";
5 if ($grupa) {
6 $sql = "SELECT opis FROM specijalizacije WHERE (link) AND (spec_id = $grupa)";
7 $sth = $dbh->prepare($sql);
8 if (!$sth) error("Cannot prepare query: \"$sql\"");
9 if (!$sth->execute()) error("Cannot execute query: \"$sql\"");
10 $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 ?>

  ViewVC Help
Powered by ViewVC 1.1.26