diff -r 119744ae4179 -r 9e680fd9d8f8 php/heslo/lib/funkce.inc.php --- a/php/heslo/lib/funkce.inc.php Sun May 10 01:13:12 2009 +0200 +++ b/php/heslo/lib/funkce.inc.php Mon Nov 28 13:53:59 2011 +0100 @@ -100,6 +100,34 @@ return null; } +function sqlDotaz($dotaz, $parametry = null) { + global $db; + try { + $dotaz = $db->prepare($dotaz); + + if ($parametry != null) { + for($i = 0; $i < count($parametry); $i++) { + $dotaz->bindParam($i+1, $parametry[$i]); + } + } + + $dotaz->execute(); + $r = $dotaz->fetchAll(); + + return $r; + } catch (PDOException $e) { + logujChybu("sqlDotaz($dotaz)"); + } +} + +function echoClanek($id, $nadpis = 'h2') { + $r = sqlDotaz("SELECT * FROM clanek WHERE id = ?", $id); + foreach ($r as $x) { + htmlZnacka($nadpis, $x['nadpis']); + echo($x['text']); + } +} + function getMicrotime(){ list($usec, $sec) = explode(" ",microtime()); return ((float)$usec + (float)$sec);