The database table below, $StateNewYork, has 75 columns. Exactly 62 of the columns are for counties within the state of New York. The counties are Albany, Allegany, Bronx, Broome, Cattaraugus, etc. --- to 62 counties.
What I am wanting to do is output the column headings, which are the names of the New York counties, for each of the 62 columns. I need to omit the thirteen column headings in the $StateNewYork table that are not the names of counties.
I need to output the names of the counties so that I may place them in a drop-down selection menu (as indicated below).
Obviously, the code below outputs the $Value/COLOR within the table cells but does not output the variable names for the column headings. The PHP programming language may not have a way to output the names of the column headings. If it does, I've not seen it yet.
Does anyone know how I might go about extracting the names of the column headings from the database table?
<select name="Counties">
require_once "./conf/config.inc.php";
$TableName = $StateNewYork;
$Query="SELECT * FROM $TableName";
$Result = mysql_db_query ($db_info[dbname], $Query, $db_connection);
while ($Row = mysql_fetch_array($Result))
{
foreach ($Row as $Key => $Value) { //Needs to output Albany, Allegany, Bronx, etc. etc.
echo "<option value="$Value">$Value</option>
}
}
</select>
Thank you in advance.
Volitics