cboyear and cbocnty are choices that the user made on a previous page. My problem is that many 35 columns in my tables are years e.g. 1978, 1979. This are huge tables and this is how I receive the data. I want to be able to query variable columns ($col) from the database with the choices that the user made --
$yr_ch; I have tried many different syntaxes. Can someone help?
$cnty_ch=$GET['cbocnty'];
$yr_ch=$GET['cboyear'];
$col = $yr_ch;
$query="select ecnty, major, $col FROM emp_major WHERE ecnty=$cnty_ch;";
$result_set = pg_Exec ($conn, $query);
$rows = pg_NumRows($result_set);
for($i=0;$i<$rows;$i++){
echo "<TD width=200><FONT size=2>" . pg_result($result_set,$i,"major") . "</FONT></TD>";
echo "<TD width=200><FONT size=2>" . pg_result($result_set,$i,"ecnty") . "</FONT></TD>";
echo "<TD width=200><FONT size=2>" .pg_result($result_set,$i, $yr_ch) . "</Font></TD>";
}
?>