<li class="option">Seattle</li> <li class="option">Stockholm</li> <li class="option">Sydney</li> <li class="option">Tokyo</li> <li class="option">Toronto</li> </ul> </div> </div> </div> </div> <div id="results"> <?php echo generateResults($searchOccupation, $searchCause, $searchLocation); ?> </div> </div> <?php $foot = <<<JAVASCRIPT \t \t<script> \t\$('#search-button button').click(function() { \t\t\$('#search').toggle(); \t}) \t</script>
$db->query('alter table Events add primary key(id)'); $db->query('alter table Persons add primary key(id)'); $db->query('alter table Countries add primary key(iso2)'); $db->query('alter table Competitions add primary key(id)'); echo "Setup primary keys.<br>"; } function generateResults($db) { // Setup AllResults table for use with generating statistics $db->query('drop table if exists AllResults'); $db->query('create view ResultsView as select competitionId,eventId,personId,best,average,countryId,gender from Results join Persons on Results.personId=Persons.id'); $db->query('create view ResultsViewCountries as select competitionId,eventId,personId,best,average,countryId, Countries.iso2 as countryCode,gender from ResultsView join Countries on ResultsView.countryId=Countries.id'); $db->query('create table AllResults (competitionId varchar(32), eventId varchar(6), personId varchar(10), best int(11), average int(11), countryId varchar(50), countryCode char(2), gender char(1), year smallint(5) unsigned)'); $db->query('insert into AllResults select competitionId,eventId,personId,best,average,countryId,countryCode,gender,year from ResultsViewCountries join Competitions on ResultsViewCountries.competitionId=Competitions.id'); $db->query('drop view ResultsViewCountries'); $db->query('drop view ResultsView'); echo "Setup AllResults table.<br>"; } $db = getDb(); stripTables($db); dropTables($db); setupPrimaryKeys($db); generateResults($db); echo "Import script finished.<br>"; $db->close();