<?php $query = "\nSELECT * \nFROM `champs`\n order by YEAR, CHAMPION\n"; $i = 0; if ($query) { //echo $query; require 'incs/mysql.php'; $conn = new mysql_conn("localhost"); $conn->select_db("rrkonig2"); $result = $conn->query($query); if (!$result) { //echo "Error: ".mysql_error()."<br>\n"; //echo $query; } else { $stuff = 'mydata=[{' . "\n\n"; $stuff .= '"schools": {' . "\n\n"; $zip = "\n\n" . '"place":['; $cny = "\n\n" . '"cny":['; $lat = "\n\n" . '"lat":['; $lon = "\n\n" . '"lon":['; $rnk = "\n\n" . '"rank":['; $v0 = "\n\n" . '"v0":['; $v1 = "\n\n" . '"v1":['; $v2 = "\n\n" . '"v2":['; $v3 = "\n\n" . '"v3":['; $v4 = "\n\n" . '"v4":['; $v5 = "\n\n" . '"v5":['; $v6 = "\n\n" . '"v6":['; $v7 = "\n\n" . '"v7":['; $v8 = "\n\n" . '"v8":['; $v9 = "\n\n" . '"v9":[';
<?php $query1 = "\n SELECT CHAMPION from champs\n group by CHAMPION\n ORDER BY CHAMPION\n "; $query2 = "\n SELECT YEAR from champs\n group by YEAR\n ORDER BY YEAR\n "; $query3 = "\n SELECT SPORT from champs\n group by SPORT\n ORDER BY SPORT\n "; $query4 = "\n SELECT DIVISION from champs\n group by DIVISION\n ORDER BY DIVISION\n "; //echo $query; require 'incs/mysql.php'; $conn = new mysql_conn("localhost"); $conn->select_db("rrkonig2"); $stuff .= 'mydropdowns = [{'; $i = 0; $addThis = ''; $result = $conn->query($query1); if (!$result) { //echo "Error: ".mysql_error()."<br>\n"; //echo $query; } else { $champion .= "\n\n" . '"champion":['; while ($row = mysql_fetch_array($result)) { $i++; if ($i > 1) { $addThis = ','; } $champion .= "{$addThis}" . "'" . addslashes($row[CHAMPION]) . "'"; } $champion .= '],'; $stuff .= $champion; } // else $i = 0;