0){$template = mysql_real_escape_string($_GET['template']);} else {$template=14;} $query = "SELECT body_id, header FROM ck_templates WHERE id = '$template'"; $result = mysql_query($query, $conn) or die(mysql_error()); mysql_select_db($database,$conn); $count_query = "SELECT id FROM ck_events WHERE post_parent = 2 "; $count_result = mysql_query($count_query, $conn) or die(mysql_error()); $num_rows = mysql_num_rows($count_result); mysql_select_db($database,$conn); $pages = round($num_rows/3); if (mysql_real_escape_string($_GET['page'])>0){$page = mysql_real_escape_string($_GET['page']);$limit = (($page*3)-3);} else {$page=1;$limit= 0;} include("includes/top.php"); include("includes/header.php"); include("includes/functions.php"); // BEGIN CONTENT --> echo "
"; echo""; echo"

UPCOMING EVENTS

"; echo"
"; if(strlen($_GET['category'])>0){$category = $_GET['category'];} else {$category=2;} $todays_date=date("Y-m-d"); $post_query = "SELECT id,title,date,end_date,synopsis,post_parent FROM ck_events WHERE date>='$todays_date' and post_parent = 2 ORDER BY date ASC limit $limit,3"; $posts = mysql_query($post_query, $conn) or die(mysql_error()); mysql_select_db($database,$conn); while (list($id,$title,$date,$end_date,$synopsis,$post_parent) = mysql_fetch_row($posts)) { if($end_date>0){$second_date=" - ".date("F jS, Y",strtotime($end_date));} echo"
"; echo"
"; echo "
"; echo"
 
"; } echo""; echo"
"; include("includes/sidebar-home.php"); echo"
"; ?>