Copy link to clipboard
Copied
I have a products page with a recordset listing items by category.
i have a 2nd recordset on the same page with color choices for each item
sql for color recordset-
mysql_select_db($database_connstore, $connstore); $query_rs_colors = "SELECT * FROM color_lookup, colors, items WHERE color_lookup.item_colorID = items.item_colorID"; $rs_colors = mysql_query($query_rs_colors, $connstore) or die(mysql_error()); $row_rs_colors = mysql_fetch_assoc($rs_colors); $totalRows_rs_colors = mysql_num_rows($rs_colors);
table color_lookup has two columns, color_ID and item_colorID, joint primary keys
table colors has two colums, color_ID and colors, color_ID is primary and auto increment (nine different colors)
table items has numerous colums, one being item_colorID, which is an index
i have the items recordset with a repeat region.
i put a dreamweaver menu inside the repeat region and populated dynamically with the color recordset.
When viewed in a browser, the items list properly but the menu shows incorrectly.
I have been told that for the list to match the item, i have to nest the recordset code inside the repeat region. I am not sure where and what code to move?
thanks for any help,
jim balthrop
ps-this is a continuation from a previous thread, but i felt it has changed so much, that i needed to start over.
Copy link to clipboard
Copied
I got the answer now.
The second recordset, colors, since it is nested inside the repeat region, had to have a variable and PHP code also inside the repeat region to set the variable.
the sql for the colors recordset
SELECT * FROM colors INNER JOIN color_lookup ON color_lookup.color_ID = colors.color_ID WHERE color_lookup.item_colorID = myfakevar
the runtime value of the variable, myfakevar is $_POST['myfakevar']
The PHP code to set the variable to filter by the item id of the items recordset
<?php
$_POST['myfakevar'] = $row_rs_itemscat3['item_colorID'];
?>
here is the page (not finished yet, but you can see the color menu)
Copy link to clipboard
Copied
Thanks for your help
jim balthrop
Find more inspiration, events, and resources on the new Adobe Community
Explore Now