Events.Id is undefined in ajax/status.php

Support and queries relating to all previous versions of ZoneMinder
Locked
mikerobb
Posts: 5
Joined: Sat Aug 29, 2009 12:54 pm

Events.Id is undefined in ajax/status.php

Post by mikerobb »

If you click on an event in the event list, it will open up a new window (a popup) and you can see the event play back. the page loads fine.

however in the log file there is this:
[Sat Aug 29 17:10:50 2009] [error] [client 192.168.202.230] SQL-ERROR(B186C4): select Events.Id as Id, MonitorId, Name, Cause, StartTime, date_format( StartTime, '%y/%m/%d %H:%i:%S' ) as StartTimeShort, EndTime, Width, Height, Length, Frames, AlarmFrames, TotScore, AvgScore, MaxScore, Archived, Videoed, Uploaded, Emailed, Messaged, Executed, Notes, min(Frames.FrameId) as MinFrameId, max(Frames.FrameId) as MaxFrameId, min(Frames.Delta) as MinFrameDelta, max(Frames.Delta) as MaxFrameDelta from Events left join Frames on Events.Id = Frames.EventId where Events.Id = undefined group by Frames.EventId limit 1, referer: http://192.168.202.7/zm/index.php?view= ... c=1&page=1
[Sat Aug 29 17:10:50 2009] [error] [client 192.168.202.230] SQL-ERROR(B186C4): Unknown column 'undefined' in 'where clause', referer: http://192.168.202.7/zm/index.php?view= ... c=1&page=1
I tracked it down to this file: ajax/status.php
this code:

Code: Select all

        if ( count($fieldSql) )
        {
            $sql = "select ".join( ", ", $fieldSql )." from ".$entitySpec['table'];
            if ( $joinSql )
                $sql .= " ".join( " ", array_unique( $joinSql ) );
            if ( $entitySpec['selector'] )
            {
                $index = 0;
                $where = array();
                foreach( $entitySpec['selector'] as $selector )
                {
                    if ( is_array( $selector ) )
                        $where[] = $selector['selector']." = ".dbEscape($_REQUEST['id'][$index]);
                    else
                        $where[] = $selector." = ".dbEscape($_REQUEST['id'][$index]);
                    $index++;
                }
                $sql .= " where ".join( " and ", $where );
error_log("MAR:TEST R-ID(".$_REQUEST['id'].") R-eID(".$_REQUEST['eid'].") SQL(".$sql.") G-ID(".$_GET['id'].") G-eID(".$_GET['eid'].")");
            }

As you can see I put in some debug (error-log) call and this is what it spits out:
[Sat Aug 29 17:29:33 2009] [error] [client 192.168.202.230] MAR:TEST R-ID(Array) R-eID() SQL(select Events.Id as Id, MonitorId, Name, Cause, StartTime, date_format( StartTime, '%y/%m/%d %H:%i:%S' ) as StartTimeShort, EndTime, Width, Height, Length, Frames, AlarmFrames, TotScore, AvgScore, MaxScore, Archived, Videoed, Uploaded, Emailed, Messaged, Executed, Notes, min(Frames.FrameId) as MinFrameId, max(Frames.FrameId) as MaxFrameId, min(Frames.Delta) as MinFrameDelta, max(Frames.Delta) as MaxFrameDelta from Events left join Frames on Events.Id = Frames.EventId where Events.Id = undefined) G-ID() G-eID(), referer: http://192.168.202.7/zm/index.php?view= ... c=1&page=1
Another interesting fact is that when this page loads, it calls this function twice. the 2nd time does not have an error, and has this as the debug data from the line i inserted:
[Sat Aug 29 17:29:33 2009] [error] [client 192.168.202.230] MAR:TEST R-ID(Array) R-eID() SQL(select Events.Id as Id, MonitorId, Name, Cause, StartTime, date_format( StartTime, '%y/%m/%d %H:%i:%S' ) as StartTimeShort, EndTime, Width, Height, Length, Frames, AlarmFrames, TotScore, AvgScore, MaxScore, Archived, Videoed, Uploaded, Emailed, Messaged, Executed, Notes, min(Frames.FrameId) as MinFrameId, max(Frames.FrameId) as MaxFrameId, min(Frames.Delta) as MinFrameDelta, max(Frames.Delta) as MaxFrameDelta from Events left join Frames on Events.Id = Frames.EventId where Events.Id = 2169) G-ID() G-eID(), referer: http://192.168.202.7/zm/index.php?view= ... c=1&page=1
Is this a sign of a problem?
Locked