I guess nobody helps unless you show that you have tried to solve the problem yourself first, which is understandable.
Well, here is the code for the dropdown I have been worlking on... So far it gives the appropriate category title to each dropdown. The trouble I am having is that it enters each of the products in the dropdowns 15 times, the amount of categories there are.
How can I get it to place each item in the dropdowns once?
Any help or suggestions is greatly appreciated!
BEGIN CODE:
MYSQL_CONNECT($dbserver, $dbuser, $dbpass) OR DIE("Unable to connect to database");
@mysql_select_db( "$dbname") or die( "Unable to select database");
?>
<?
$result = mysql_query('select id, cat_name from category');
while ($row = mysql_fetch_array($result)) {
echo $row["cat_name"].":<br>";
$id = $row["id"];
echo '<select name=product[]>';
$XX = "data empty!";
$aku = mysql_query("SELECT category_id, item_name, item_id FROM category, item WHERE $id=category_id ORDER BY cat_name");
while ($row = mysql_fetch_array($aku))
{
$colom_name=$row["item_id"];
$colom_name2=$row["item_name"];
echo "<option value=$colom_name>$colom_name2\n";
}
if ($colom_name="")
{
print ("$XX");
}
echo "</select>\n";
print ("<br><br>");
}
mysql_free_result($result);