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