1 |
<?php |
2 |
require("Smarty.class.php"); |
3 |
require("conn.inc"); |
4 |
|
5 |
$smarty = new Smarty; |
6 |
|
7 |
$smarty->assign( array ( Title=>"Pliva d.d." ) ); |
8 |
|
9 |
$section="products"; |
10 |
|
11 |
$title="Products : Human Health"; |
12 |
$lpic="products"; $lext=".jpg"; |
13 |
$mpic="products.gif"; |
14 |
$back_url="products.php"; |
15 |
|
16 |
$smarty->assign( array ( lpic=>$lpic, lext=>$lext, mpic=>$mpic, Section_title=>$title ) ); |
17 |
|
18 |
$sth = $dbh->prepare("select type,description from prod_type"); |
19 |
$sth->execute(); |
20 |
$types[]="any"; |
21 |
$type_desc[]="any"; |
22 |
while ($row=$sth->fetchrow_array()) { |
23 |
$types[]=$row[0]; |
24 |
$type_desc[]=$row[1]; |
25 |
} |
26 |
$smarty->assign(array( |
27 |
types=>$types, |
28 |
type_desc=>$type_desc |
29 |
)); |
30 |
|
31 |
$sql_where=""; |
32 |
|
33 |
if (isset($type) && $type!="any") { |
34 |
$sql_where.=" type='$type'"; |
35 |
} |
36 |
|
37 |
if (isset($search) && $search!="" && $search!="all") { |
38 |
if ($sql_where != "") { |
39 |
$sql_where.=" and "; |
40 |
} |
41 |
$sql_where.=" (upper(brand) like upper('%$search%') or |
42 |
upper(form) like upper('%$search%') or |
43 |
upper(generic) like upper('%$search%') or |
44 |
upper(description) like upper('%$search%') ) |
45 |
"; |
46 |
} |
47 |
|
48 |
if ($sql_where != "") { |
49 |
$sql_where=" where $sql_where"; |
50 |
} |
51 |
|
52 |
if (isset($search)) { |
53 |
|
54 |
$sql="select distinct brand,form,generic,description,type,atc,town,smpc,have_smpc,tm from products $sql_where order by brand asc"; |
55 |
$sth = $dbh->prepare("$sql"); |
56 |
$sth->execute(); |
57 |
while ($row=$sth->fetchrow_hash()) { |
58 |
$data[]=$row; |
59 |
} |
60 |
|
61 |
if (!$data) { |
62 |
$smarty->assign("data","notfound"); |
63 |
} |
64 |
|
65 |
$smarty->assign("data",$data); |
66 |
$smarty->assign("search",$search); |
67 |
|
68 |
} else { |
69 |
$smarty->assign("search","all"); |
70 |
} |
71 |
|
72 |
$smarty->assign( array(type=>"$type", |
73 |
show_description=>$show_description |
74 |
)); |
75 |
$main=$smarty->fetch("human_health.tpl"); |
76 |
|
77 |
include("common.inc"); |
78 |
$smarty->assign( array(back_url=>$back_url, MAIN=>$main)); |
79 |
|
80 |
$smarty->display("index.tpl"); |
81 |
?> |