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 distinct type from products"); |
19 |
$sth->execute(); |
20 |
$types[]="any"; |
21 |
while ($row=$sth->fetchrow_array()) { |
22 |
$types[]=$row[0]; |
23 |
} |
24 |
$smarty->assign("types",$types); |
25 |
|
26 |
$sql_where=""; |
27 |
|
28 |
if (isset($type) && $type!="any") { |
29 |
$sql_where.=" type='$type'"; |
30 |
} |
31 |
|
32 |
if (isset($search) && $search!="" && $search!="all") { |
33 |
if ($sql_where != "") { |
34 |
$sql_where.=" and "; |
35 |
} |
36 |
$sql_where.=" (upper(brand) like upper('%$search%') or |
37 |
upper(form) like upper('%$search%') or |
38 |
upper(generic) like upper('%$search%') or |
39 |
upper(description) like upper('%$search%') ) |
40 |
"; |
41 |
} |
42 |
|
43 |
if ($sql_where != "") { |
44 |
$sql_where=" where $sql_where"; |
45 |
} |
46 |
|
47 |
if (isset($search)) { |
48 |
|
49 |
$sth = $dbh->prepare("select distinct brand,form,generic,description,type,atc,town,smpc,have_smpc from products $sql_where"); |
50 |
$sth->execute(); |
51 |
while ($row=$sth->fetchrow_hash()) { |
52 |
$data[]=$row; |
53 |
} |
54 |
|
55 |
if (!$data) { |
56 |
$smarty->assign("data","notfound"); |
57 |
} |
58 |
|
59 |
$smarty->assign("data",$data); |
60 |
$smarty->assign("search",$search); |
61 |
|
62 |
} else { |
63 |
$smarty->assign("search","all"); |
64 |
} |
65 |
|
66 |
$smarty->assign("type","$type"); |
67 |
$main=$smarty->fetch("human_health.tpl"); |
68 |
|
69 |
include("common.inc"); |
70 |
$smarty->assign( array(back_url=>$back_url, MAIN=>$main)); |
71 |
|
72 |
$smarty->display("index.tpl"); |
73 |
?> |