I have a MySQL table and would like to create a number of dropdowns where my raceid = programid.
For example
Table MYRACES
ID RACEID PROGRAMID TITLE DISTANCE
1 1 1 MYRACE 5
2 1 1 HISRACE 6
3 1 1 HERRACE 7
4 2 2 THATRACE 8
5 2 2 WHATRACE 9
6 3 3 HRDRACE 10
7 3 3 TUFFRACE 11
So in essence using PHP and MySQL I would like to create a separate dropdown for every instance where my raceid = programid and return the title in the dropdown. In the example above I would have 3 separate dropdowns.
So far I have
$programs = $wpdb->get_results("SELECT * FROM myraces WHERE raceid = programid", 'ARRAY_A');
foreach ($programs as $program) {
echo '<select>';
echo '<option value="'.$program['$id'].'">'.$program['title'].'</option>';
echo '</select>';
}
Thanks in advance.
I’m guessing you want something like this: