well this if/else would just paste INSIDE your existing one, like this:
[php]<?php
date_default_timezone_set(‘America/New_York’);
$con = mysql_connect(“localhost”,"******","******");
if (!$con) { die('Could not connect: ’ . mysql_error()); }
mysql_select_db("******", $con);
$result = mysql_query(“SELECT * FROM wp_aec_event WHERE DATE_ADD(NOW(), INTERVAL 12 HOUR) < start LIMIT 1 ORDER BY start”);
if ( mysql_num_rows( $result ) > 0 ) {
while($row = mysql_fetch_array($result)) {
if ((!isset($SESSION[‘end’])) | ($SESSION[‘end’] > time())) {
session_start();
$_SESSION = $result;
} else {
// here you put the code that USES $_SESSION (instead of $result) to display the data in the ticker
}
// Event Listing
}} else {
date_default_timezone_set('America/New_York');
$time = new DateTime();
$time->sub(date_interval_create_from_date_string('2 hours'));
switch ($time->format('l')) {
case 'Sunday': ?>
Sunday Content
<? break;
// next day of the week, etc.
?>[/php]
but again something you are not understanding it seems: PHP is run EVERY time a page is loaded. I load up yoursite.com and you load it 2 seconds apart, that mysql query just ran two times and got whatever data matches that query twice. that will happen EVERY time ANYONE loads your page.
so what that means, is without changing more than your query it is IMPOSSIBLE to have it CACHE a specific event, to make sure it keeps showing that event until it ends. it simply doesn’t work that way. i’m sorry, what i have showed you i think is your best alternative, there are others. but I can guarantee that just changing your query won’t get what you are asking for.