diff -r 119744ae4179 -r 693f2b2587aa 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 Fri Aug 28 17:24:23 2009 +0200 @@ -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);