I am trying to echo out a dome data out of a table but for some reason it is only echoing out two results. Probably because there are only two possible numbers under sub_parent. I was hoping it would echo out all 6 rows but just group them? Any ideas what's going wrong?
<?php
require_once 'db/db.php';
$sql = "SELECT *
FROM main_menu_sub
GROUP BY sub_parent
ORDER BY id
";
$result = $con->query($sql);
$con->close();
?>
<?php
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
?>
<li><a href="<?php echo $row["Sub_menu_url"]; ?>"><?php echo $row["Sub_menu_title"]; ?></li>
<?php
}
}
?>