This question already has an answer here:
for some reason unless im overlooking something, This block of code here:
<?
include_once("connect.php");
$sql = "SELECT * FROM categories ORDER BY category_title ASC";
$res = mysqli_query($con,$sql) or die(mysql_error());
$categories ="";
if (mysqli_num_rows($res) > 0) {
while($row = mysqli_fetch_assoc($res)){
$id = $row['id'];
$title = $row['category_title'];
$description = $row['category_decription'];
$categories .= "<a href='#' class='cat_links'>".$title." - <font size='-1'>".$description."</font></a>";
}
echo $categories;
} else {
echo"<p>There are no categories available yet.</p>";
}
?>
Seems to echo this out onto the page:
0) { while($row = mysqli_fetch_assoc($res)){ $id = $row['id']; $title = $row['category_title']; $description = $row['category_decription']; $categories .= "".$title." - ".$description.""; } echo $categories; } else { echo" There are no categories available yet.
"; } ?>
What have i done wrong?
Thanks in advance!
</div>