get_results('select distinct wpgvenue_city from wpg_venues');
$select = '
';
return $select;
}
function giglogadmin_getconcerts()
{
global $wpdb;
// Shortcodes RETURN content, so store in a variable to return
$content = '';
// $content .= 'CITY | ID | BAND | VENUE | DATE | TICKETS | EVENT | ';
$content .= 'CITY | BAND | VENUE | DATE | TICKETS | EVENT |
';
// Use the submitted "city" if any. Otherwise, use the default/static value.
$cty = filter_input(INPUT_POST, 'selectcity');
$cty = $cty ? $cty : 'ALL';
$venue = filter_input(INPUT_POST, 'selectvenue');
//echo($_POST['selectvenue']);
$venue = $venue ? $venue : '0';
$query = "SELECT wpgc.id, wpgb.wpgband_name as band ,wpgv.wpgvenue_name as venue ,wpgc.wpgconcert_date, wpgc.wpgconcert_tickets, wpgc.wpgconcert_event, wpgv.wpgvenue_city, wpgv.wpgvenue_webpage
FROM wpg_concerts wpgc, wpg_bands wpgb, wpg_venues wpgv
where wpgc.band=wpgb.id
and wpgc.venue = wpgv.id
and wpgconcert_date >= CURDATE()";
$query .= ($cty == "ALL") ? "" : " and wpgv.wpgvenue_city='" . $cty . "'";
$query .= ($venue == "0") ? "" : " and wpgv.id='" . $venue . "'";
$query .= " order by wpgv.wpgvenue_city, wpgconcert_date, wpgc.id";
//echo($query);
$results = $wpdb->get_results($query);
$lastType = '';
foreach ($results AS $row) {
$content .= '';
if ($lastType != '' && $lastType != $row->wpgvenue_city) {
$content .= '' . $row->wpgvenue_city . ' |
';
}
if ($lastType == '') {
$content .= '' . $row->wpgvenue_city . ' |
';
}
// Modify these to match the database structure
// $content .= '' . $row->id. ' | ';
$content .= ' | ';
$content .= '' . $row->band . ' | ';
$content .= '' . $row->venue . ' | ';
$fdate = strtotime($row->wpgconcert_date);
$newformat = date('d.M.Y', $fdate);
//$content .= DATE_FORMAT($fdate,'%d.%b.%Y');
$content .= '' . $newformat . ' | ';
$content .= 'Tickets | ';
$content .= 'Event link | ';
$content .= '
';
$lastType = $row->wpgvenue_city;
}
$content .= '
';
// return the table
return $content;
}