Here are some examples:
//assume database connection open, database selected
//select the categories from the tutorials table
//use DISTINCT so only 1 instance of each category is shown
$query = mysql_query("SELECT DISTINCT `Category` FROM `tutorials`")
OR die(mysql_error());
//write the html down down menu
echo '<select name="cat">' . "\n";
//loop through the result set
while ($row = mysql_fetch_array($query)) {
//prepare the data for output
$category = htmlspecialchars(stripslashes($row['Category']));
//write out the current option
echo '<option value="' . $Category . '">' . $Category . "</option>\n";
}
echo '</select>' . "\n"; //the drop down menu ends here
$query = mysql_query("SELECT * FROM `tutorials` WHERE `Category`='$cat'")
OR die(mysql_error());
//lets display using an un-ordered list
echo "<ul>\n";
while ($row = mysql_fetch_array($query)) {
echo '<li>' . htmlspecialchars(stripslashes($row['title']))
. htmlspecialchars(stripslashes($row['date'])) . "</li>\n";
}
echo "</ul>\n";