I have problem with functions. I write them in config/funkcije.php. In folder config/ I have db.php which connects to database, etc... When I open in browser config/funkcije.php nothing shows on that page but it should echo out some results from DB.
This is my function:
include 'db.php';
function prikaz_posebne_ponude()
{
$sql = "SELECT * FROM posebna_ponuda ORDER BY id DESC LIMIT 1";
$sql1 = $mysqli->query("$sql");
while ($row = $sql1->fetch_assoc()) {
$glavni_naziv = $row[$lang];
if (empty($glavni_naziv)) {
echo '';
} else {
echo "<div class='row-banner'>";
echo "<h3><span>" . $langArray['rezervacija_smjestaja'] . "</span></h3>";
echo "<p>" . $glavni_naziv . "</p>";
echo "</div>";
}
}
}
But when I remove function prikaz_posebne_ponude(){ and } on the last line everything works fine. Why is this happening?