[thelist] getting the next row
Mark Groen
markgroen at gmail.com
Sat Mar 5 20:00:35 CST 2005
I have a list of events for a day and have been able to print an event
while it's within the start/stop times. Now I want to print the next
two events, (the sql takes care of the day/order), but stuck on how to
implement this. Thought now() would be the trick, but missing
something in the translation. code:
<code>
$query = "SELECT id,title,dj,show_day,show_start,show_end,show_echo
FROM schedule ";
$query .= "WHERE show_day = '$myDay' ";
$query .= "ORDER BY show_start ";
$mysql_result = mysql_query($query, $mysql_link);
$showList = $mysql_result;
$i = 0; //initialize the title count
while($row = mysql_fetch_array($showList))
{ $i++; $nowOn++;
$id = $row[0];
$title = $row[1];
$dj = $row[2];
$show_day = $row[3];
$show_start = $row[4];
$show_end = $row[5];
$show_echo = $row[6];
$nextStart = dttm2unixtime("2004-01-31 $show_start"); //2004-11-28 10:20:00
$nextEnd = dttm2unixtime("2004-01-31 $show_end");
$theTime = dttm2unixtime("2004-01-31 $serverTime");
//$hourStart = explode(":", $show_start);
//$hourEnd = explode(":", $show_end);
$num_rows = mysql_num_rows($showList);
$a = array_fill(1, $num_rows, 'foo');
if(( ($theTime >= $nextStart)&&($theTime <= $nextEnd) )) //were inside
the shows' hour(s) all is good
{
print("<h1>now playing</h1>\n<strong>");
include("timeyes.php");
print("</strong><br>$title<br>");
$nowTrue = "1";
//the nowTrue = 1 loop start
if($nowTrue = "1")
{ if(( (next($a) != '') ))
{ print("<h1>next</h1>\n<strong>");
include("timeyes.php");
print("</strong><br>$title<br>");
}
}
}else //the next show is sometime after this hour
{ if($nextStart > $theTime)
{ $nowTrue = "noShow"; }
}
</code>
this prints the info from the same row as "now playing" instead of the
next row as I expected, what am I missing?
cheers,
Mark
More information about the thelist
mailing list