function getEventData($eventStructure) {
foreach($eventStructure as $eventKey=>$eventValue) {
if (!isset($eventSelectionClause[$eventValue['sport_key']])) {
$eventSelectionClause[$eventValue['sport_key']] = '(0';
}
$eventSelectionClause[$eventValue['sport_key']] .= " OR events.event_key = '" . $eventValue['event_key'] . "'\n";
}
foreach($eventSelectionClause as $eventKey=>$eventValue) {
$eventSelectionClause[$eventKey] .= ')';
}
// baseball
if (isset($eventSelectionClause[15007000])) {
$eventDataQuery = <<$eventDataQuery
";
$conn = dbOpen();
$eventDataResult = mysql_query($eventDataQuery, $conn);
while ($theRow = mysql_fetch_assoc($eventDataResult)) {
$eventData[$theRow['event_key']]['event_key'] = $theRow['event_key'];
$eventData[$theRow['event_key']]['start_date_time'] = $theRow['start_date_time'];
$eventData[$theRow['event_key']]['event_status'] = $theRow['event_status'];
$eventData[$theRow['event_key']]['inning_value'] = $theRow['inning_value'];
$eventData[$theRow['event_key']]['inning_half'] = $theRow['inning_half'];
$eventData[$theRow['event_key']]['outs'] = $theRow['outs'];
$eventData[$theRow['event_key']]['runner_on_first'] = $theRow['runner_on_first'];
$eventData[$theRow['event_key']]['runner_on_second'] = $theRow['runner_on_second'];
$eventData[$theRow['event_key']]['runner_on_third'] = $theRow['runner_on_third'];
$eventData[$theRow['event_key']]['runner_on_first_id'] = $theRow['runner_on_first_id'];
$eventData[$theRow['event_key']]['runner_on_second_id'] = $theRow['runner_on_second_id'];
$eventData[$theRow['event_key']]['runner_on_third_id'] = $theRow['runner_on_third_id'];
$eventData[$theRow['event_key']]['pitcher_id'] = $theRow['pitcher_id'];
/* Get the players names into the structure (?)
if ($eventData[$theRow['event_key']]['runner_on_first']) {
$eventData[$theRow['event_key']]['runner_on_first_name'] = $player_name[$eventData[$theRow['event_key']]['runner_on_first_id']];
}
else {
$eventData[$theRow['event_key']]['runner_on_first_name'] = "";
}
if ($eventData[$theRow['event_key']]['runner_on_second']) {
$eventData[$theRow['event_key']]['runner_on_second_name'] = $player_name[$eventData[$theRow['event_key']]['runner_on_second_id']];
}
else {
$eventData[$theRow['event_key']]['runner_on_second_name'] = "";
}
if ($eventData[$theRow['event_key']]['runner_on_third']) {
$eventData[$theRow['event_key']]['runner_on_third_name'] = $player_name[$eventData[$theRow['event_key']]['runner_on_third_id']];
}
else {
$eventData[$theRow['event_key']]['runner_on_third_name'] = "";
}
*/
}
dbClose($conn);
}
// basketball
if (isset($eventSelectionClause[15008000])) {
$eventDataQuery = <<