Hi there,
i need to get the date of a record called X-1
when i parse the record X.
the code looks like
<?php
function myRecordHandler($record)
{
$date = $record["AUSSTRAHLUNG/DATUM"];
$date = explode(".",$date);
$date2 = $date[2]."-".$date[1]."-".$date[0];
$start = $record["AUSSTRAHLUNG/BEGINNENDEUHRZEIT"];
$start = substr($start,0,5);
$start .=":00";
$date2 .=" $start";
$start=explode(":",$start);
$start_temp = $start[0]."".$start[1];
if ((($startzeit_alt > $start_temp)&&$startzeit_alt) || $next_day){ $unix_timestamp =
mktime($start[0],$start[1],$start[2],$date[1],$date[0]+1,$date[2]);
$next_day=true;
}
else{ $unix_timestamp = mktime($start[0],$start[1],$start[2],$date[1],$date[0],$date[2]);}
$startzeit_alt = $start_temp;
INSERT INTO etc...
}
$basedir .="xml/premiere/";
$handle = opendir($basedir);
while ($filename = readdir($handle)) {
$path =$basedir.$filename;
MagicParser_parse("$path","myRecordHandler","xml|PROGRAMMLISTING/EVENT/");
}
?>
Hope to get an answer thx.
Adrian
Hi Adrian,
I think it is just because you have not declared $startzeit_alt as global. Add the global declaration on first line of your record handler function as follows:
<?php
function myRecordHandler($record)
{
global $startzeit_alt;
...
?>
That should do the trick!
Cheers,
David.