[thelist] using a mysql record set as a navigation

Andrew Maynes andrew at humanbehaviour.co.uk
Thu Feb 6 02:14:03 CST 2003


Hi All

I am forever asking questions about php and knowing that there is a solution but
wanting to know not only the solution but also the opinions of you professional
developers.

So here is the latest.  I have a set of records that are categories. A query
pulls all the records for category and in turn this are then <links> to items of
that said category.  Simple.  Ok here is the bit I want some feeback on.  I want
to create another table (if this is the solution) and split the category into
groups, this is for the purpose of navigation.  So istead of having 30
categories I will have X number of goups with categories in X group.

Do I need to create another table to do this (as we did with the ref_colour) or
can I split the output in a simple way with creating a table.  I guess that some
form of id is needed to seperate the records?

This is what I have:

$result=mysql("$DBName","SELECT * FROM Category ORDER BY Category");
fontFace("Arial","Select a category:<br><br>");
echo "<ul>";
while ($row  =  mysql_fetch_row($result)) {
$Cat=$row[0];
$CatID=$row[1];
echo"<li><a href='$Relative/items.php?CA=$CatID&UID=$UID'>$Cat</a></li>";
        }
echo "</ul>";

Andrew




More information about the thelist mailing list