8 && $distval <= 67 && strpos($dist, 'A') !== false ) $ndist = $distval . "B"; elseif ($distval > 8 && $distval <= 66 && strpos($dist, 'B') !== false ) { $ndist1 = $distval + 1; $ndist = $ndist1 . "A"; } else $ndist = "01A"; //previous districts if ($distval > 1 && $distval <= 10 && strpos($dist, 'A') !== false) { $pdist1 = $distval - 1; $pdist = "0" . $pdist1 . "B"; } elseif ($distval >= 1 && $distval < 10 && strpos($dist, 'B') !== false) $pdist = "0" . $distval . "A"; elseif ($distval > 9 && $distval <=67 && strpos($dist, 'A') !== false) { $pdist1 = $distval - 1; $pdist = $pdist1 . "B"; } elseif ($distval > 9 && $distval <=67 && strpos($dist, 'B') !== false) $pdist = $distval . "A"; else $pdist = "67B"; $allowedSections = ['dp02', 'dp03', 'dp04', 'dp05']; $sect = strtolower($_GET['section'] ?? 'dp05'); if (!in_array($sect, $allowedSections, true)) { http_response_code(400); exit('Invalid section.'); } //set active tab and title if ($sect == 'dp05') { $title = "Demographic"; $dp05 = 'nav-link active text-joint font-weight-bold'; }else { $dp05 = 'nav-link'; } if ($sect == 'dp02') { $title = "Social"; $dp02 = 'nav-link active text-joint font-weight-bold'; }else { $dp02 = 'nav-link'; } if ($sect == 'dp03') { $title = "Economic"; $dp03 = 'nav-link active text-joint font-weight-bold'; }else { $dp03 = 'nav-link'; } if ($sect == 'dp04') { $title = "Housing"; $dp04 = 'nav-link active text-joint font-weight-bold'; }else { $dp04 = 'nav-link'; } include_once('/home/web/gis/config/config.php'); $pageTitle = 'MN House Profiles'; $announcement = file_get_contents('/web/config/announcement.php'); include_once($header); print ""; //title print "

American Community Survey Profile Report | 2019-2023 (5-year estimates)

"; //sub-title print "

House District $dist

$title Characteristics

"; //tabs print "
"; // add About and Download links; //table print "
"; //connect to database $config = require '/etc/pgconfig/gis_web.php'; $options = sprintf( "host='%s' port='5432' user='%s' password='%s' dbname='districts'", $config['host'], $config['user'], $config['password'] ); $cn = pg_connect($options); if ($cn) { //print "Connection Successful!"; } else print "Connection Failed!"; if ( $dist != null ) { $sql = pg_query($cn, "SELECT name, description from acs_23_5yr_".$sect."_metadata where name like '%E' and name not like '%PE'order by id"); $sql2 = pg_query($cn, "SELECT name, description from acs_23_5yr_".$sect."_metadata where name like '%PE' order by id"); $rec = NULL; for($i=0;$i"; print_r($string1); echo ""; if ((strpos($string5, '-ADJUSTED DOLLARS)') !== false) && $sect == 'dp03') $string6 = str_replace('-ADJUSTED DOLLARS)',' ', $string5); else $string6 = $string5; $type = gettype($row2[$i]); if ($row2[$i] == $row3[$i]) { $row3[$i] = "(X)"; } if ($row2[$i] !== '(X)' and strpos($string, 'Median age (years)') == false) $num2 = str_replace(".0","",number_format($row2[$i],1)); else $num2 = $row2[$i]; if ($row4[$i] == $row5[$i]) { $row5[$i] = "(X)"; } if ($row4[$i] !== '(X)' and strpos($string, 'Median age (years)') == false) $num4 = number_format($row4[$i]); else $num4 = $row4[$i]; if ($rec == $string3) { //Most rows $line1 = "$string"; //string1 print ""; } else{ $line1 = "$string2 - $string"; print " "; } $rec = $string3; } } print "
District Demographics Table
Subject District Percent
$line1 $num2 $row3[$i]
$line1 $num2 $row3[$i]
"; include_once($footer); ?>