Hi,
I'm trying to create a drop-down list which is made up of two items per line. Is this possible?
I have a table COUNTRIES from which I wish to select all the European countries & then cross reference them with another table PROPERTY and get all the entries for each country.
The code I'm using is as below, however this returns a drop-down with just the countries names, nothing of the count. Any help would be much appreciated... Even if you tell me it's not possible!
<?php
// FUNCTION TO SELECT COUNTRIES
function mh_get_countries_europe($countries_id = '', $with_iso_codes = false) {
$countries_array = array();
$countries = mh_db_query("select countries_id, countries_name from " . TABLE_COUNTRIES . " WHERE countries_continent = '1' order by countries_name");
while ($countries_values = mh_db_fetch_array($countries)) {
$countries_array[] = array('countries_id' => $countries_values['countries_id'],
'countries_name' => $countries_values['countries_name']);
}
return $countries_array;
}
// FUNCTION TO COUNT ENTRIES PER COUNTRY
function mh_count_matches_in_country($country_id, $include_inactive = false) {
$matches_count = 0;
$matches_query = mh_db_query("select count(*) as total from " . TABLE_PROPERTY . " p, " . TABLE_COUNTRIES . " c where p.property_country_id = c.countries_id");
}
$matches = mh_db_fetch_array($matches_query);
$matches_count += $matches['total'];
// FUNCTION TO CREATE JOINT DROP-DOWN
function mh_get_europe_list($name, $selected = '', $parameters = '') {
$countries_array = array(array('id' => '', 'text' => PULL_DOWN_DEFAULT));
$countries = mh_get_countries_europe();
$matches = mh_count_matches_in_country($counter);
$size = sizeof($countries);
for ($i=0; $i<$size; $i++) {
$countries_array[] = array('id' => $countries[$i]['countries_id'], 'text' => $countries[$i]['countries_name'] . $matches[$i]);
}
return mh_draw_pull_down_menu($name, $countries_array, $selected, $parameters);
}
echo mh_get_europe_list('country') ?>
Cheers
Clint