Hello,
I'm busy with developing my very own CMS and now i'm trying to create a dynamically menu with mysql now i have the following code and it works perfect:
but i want to work with 2 database tables named: "cms_menu_categories" and "cms_menu_pages"
and the linking between the two tables is a field "p_cat_id" and "c_id"
so i want if i create a page i can assign a categorie to it and it wil be created like the code above, without the explode,
does someone has the time to create the join query , or atleast explain it to me how to link the two tables.
Kind regards,
Kevin
I'm busy with developing my very own CMS and now i'm trying to create a dynamically menu with mysql now i have the following code and it works perfect:
PHP:
<ul id="nav">
<li class="first"><a href="#">Home</a></li>
<?php
$sCSql = mysql_query("Select * From cms_menu_categories");
while($test = mysql_fetch_assoc($sCSql)){
if(!empty($test['c_Pages'])){
echo '<li><a href="#">'.$test['c_Name'].'</a><ul>';
$testing = explode(' - ', $test['c_Pages']);
foreach($testing as $line){
echo '<li><a href="/'.strtolower($test['c_Name']).'/'.strtolower($line).'">'.$line.'</a></li>';
}
echo '</ul>';
?>
<?php
}else{
echo '<li><a href="#">'.$test['c_Name'].'</a><ul>';
}
}
?>
</ul>
and the linking between the two tables is a field "p_cat_id" and "c_id"
so i want if i create a page i can assign a categorie to it and it wil be created like the code above, without the explode,
does someone has the time to create the join query , or atleast explain it to me how to link the two tables.
Kind regards,
Kevin