Page 1 of 1

error with presets

Posted: Tue Mar 27, 2007 4:20 pm
by breizhbug
Hello,
When I use presets to set up a new monitor, after choosing camera, I have this error message Unknown column 'DefaultView' in 'field list'

May be someone could help me ?
Pascal

Monitor Presets Fix

Posted: Tue Mar 27, 2007 11:14 pm
by ammaross
I did some checking on your error and found out that my ZoneMinder does it as well. So, why not fix it? Here's the fix:

Code: Select all

	$new_x10_monitor = isset($x10_monitor)?$x10_monitor:array();
}
if ( !empty($preset) )
{
-	$result = mysql_query( "select Type, Device, Channel, Format, Host, Port, Path, Width, Height, Palette, MaxFPS, Controllable, ControlId, ControlDevice, ControlAddress, DefaultRate, DefaultScale from MonitorPresets where Id = '$preset'" );
+	$result = mysql_query( "select Type, Device, Channel, Format, Host, Port, Path, Width, Height, Palette, MaxFPS, Controllable, ControlId, ControlDevice, ControlAddress, " /*DefaultView,*/ . "DefaultRate, DefaultScale from MonitorPresets where Id = '$preset'" );
	if ( !$result )
		die( mysql_error() );
	$preset = mysql_fetch_assoc( $result );
	mysql_free_result( $result );
Why does this work? The select statement in the changed line above asked for a DefaultView column from the MonitorPresets table. There is no DefaultView column in that table, so, just don't ask for it.

ZM, was this just a bit of legacy code or something important? :roll:

I tested this fix on my copy and works 100%.

Posted: Wed Mar 28, 2007 6:34 am
by breizhbug
:oups: Sorry, I didn't try to search before posting...
OK, issue closed

Posted: Wed Mar 28, 2007 7:08 pm
by ammaross
:oops: Sorry, I didn't try to search before posting...
No worries, I didn't check the wiki either. :wink:

Posted: Thu Mar 29, 2007 4:06 pm
by breizhbug
I've tried to patch 1.22.3 with monitor presets patch found in wiki.
Patch applied on file zm_html_view_monitor.php in /usr/local/zcr/ZoneMinder-1.22.3 (/web)

Error still the same.

Do I need to compile again or not.
Excuse if my question seems stupid but I have still some gap with linux architecture
Thanks

Posted: Thu Mar 29, 2007 6:54 pm
by ammaross
breizhbug wrote:I've tried to patch 1.22.3 with monitor presets patch found in wiki.
Patch applied on file zm_html_view_monitor.php in /usr/local/zcr/ZoneMinder-1.22.3 (/web)

Error still the same.
One of two things, either your apache is using a location other than /web for its files, or the patch was not successful. Check your /web dir for a patch reject file, or just open the zm_html_view_monitor.php and use my first posting to verify the line was modified properly. (the - is the old line and + is the new line). If it was applied properly, and apache does use /web for its web files, try closing the webpage and trying again.
breizhbug wrote: Do I need to compile again or not.
Excuse if my question seems stupid but I have still some gap with linux architecture
Thanks
No need ot recompile. We are not changing any source code, just PHP scripts.

Posted: Fri Mar 30, 2007 12:46 pm
by breizhbug
Hi,

I check, patch is really applied. I verified into zm_html_view_monitor.php.
So apache is using same file in another directory
I will check with locate and modify.
Thanks

Posted: Fri Mar 30, 2007 6:29 pm
by cordel
The file that needs to be patched is the one that is installed and not your source file. You can copy the patched file to the installed location and it will work fine in this case as php files don't get compiled and is an interpreted language.