I am pretty new to this so just trying to figure something out. My overall goal is to create a drop down menu in my navbar that shows themes and when you click on an element it changes the color theme of the page. In my database I have 2 tables. One that lists the theme and an Id for the theme and another table that has the hex codes related to that theme.
Ordered as such:
themes table:
ID | Theme
colors table: (Theme ID and ID in themes table are the same)
ID | Theme ID | hex Code
I am trying to break this down into steps:
If there is a smarter way to do this I would love to know about it.The trouble I am having right now is. I am new to PHP and I don't know how to do step 1. I think I can manage steps 2-3 but I can't find anything on how to add an li to a drop down list for each row retrieved.
<li>themes
<ul>
<!-- add theme names here -->
</ul>
</li>
do your query
$toReturn="";
$query="select * from themes,colors where Theme_ID=ID";
$result= mysql_query($query);
in this way you get all your information. Now iterate on them
while ($r=mysql_fetch_assoc($result)){
$toReturn=$toReturn. "<li>themes<ul>".$r[name of field to extract]. "</ul></li>";}
echo $toReturn;
In this way you get what you want