1 |
ravilov |
1.1 |
<?php |
2 |
ravilov |
1.5 |
include("inc/conn.php"); |
3 |
|
|
$sql = "SELECT ban_id, slika, alt, url FROM banneri WHERE (".($isMed && $isReg ? "" : "NOT ")."plivamed) ORDER BY ban_id"; |
4 |
|
|
$sth = $dbh->prepare($sql); |
5 |
|
|
if (!$sth) error("Cannot prepare query: \"$sql\""); |
6 |
|
|
if (!$sth->execute()) error("Cannot execute query: \"$sql\""); |
7 |
|
|
$banneri = array(); |
8 |
|
|
while ($row = $sth->fetchrow_array()) { |
9 |
|
|
list($id, $pic, $alt, $url) = $row; |
10 |
|
|
$banneri[$id] = array("slika" => $pic, "alt" => $alt, "url" => $url); |
11 |
|
|
} |
12 |
|
|
$sth->finish(); |
13 |
|
|
$dbh->disconnect(); |
14 |
|
|
function Click($id) { |
15 |
|
|
if (!$id) return; |
16 |
|
|
$sql = "UPDATE banneri SET klikovi = klikovi + 1 WHERE ban_id = $id"; |
17 |
|
|
include("inc/conn.php"); |
18 |
|
|
$dbh->dbh_do($sql); |
19 |
|
|
$dbh->disconnect(); |
20 |
ravilov |
1.1 |
} |
21 |
|
|
?> |