I'm trying to build a function which enables me to build a simple Navigation (or list, matter of fact) from a database table.
Problem is, the variables in the brackets don't work, how can I fix this?
function buildNav($DbRow, $DbName) {
$nav_qry = "SELECT $DbRow FROM $DbName WHERE 1";
$nav_res = mysqli_query($con, $nav_qry);
echo "<ul>";
while ($row = mysqli_fetch_assoc($nav_res)) {
echo "<li id='" . $row[$DbRow] . "'><a href='?id=" . $row[$DbRow] . "' class='nav-point'>". $row[$DbRow] ."</a></li>";
}
echo "</ul>";
}
Thanks!