https://www.icyphoenix.com/viewtopic.php?f=35&t=4009&p=27464#p27464
-----------------------------------
moreteavicar
Tue 08 Apr, 2008 12:46

Re: [BUG] Critical Error - Line : 1010 - File : Functions.ph
-----------------------------------
[quote user="Lopalong" post="27433"]All too confusing!  :P 

Edit to stay on topic:

The bottom line is: The error wasn't being generated by the Db, and there really was no need for me to modify it. 

When and / or if it happens again, I will compare the Db entries against def_themes.php, and that should or will indicate where the the problem or request was being generated from. Until then, it's a mystery-bag.

 :mricy:[/quote] Hmmm.... you are suffering from amnesia from your very first post which clearly states where the error occurred. ;) 
Actyall its because your board default theme setting - it contains an entry for a theme that doesn't exist.

To see whats happening to give this error, here are the relevant lines from functions.php:

[code linenumbers=false]
START - query the database:
		$sql = 'SELECT * FROM ' . THEMES_TABLE . ' WHERE themes_id = ' . (int) $style;
		if ( !($result = $db->sql_query($sql)) )
		{
			message_die(CRITICAL_ERROR, 'Could not query database for theme info');
		}

		if ( !($row = $db->sql_fetchrow($result)) )
		{
			// We are trying to setup a style which does not exist in the database
			// Try to fallback to the board default (if the user had a custom style)
			// and then any users using this style to the default if it succeeds
			if ( ($style != $board_config['default_style']) || ($old_style != false) )
			{
				if ($old_style != false)
				{
					$board_config['default_style'] = $old_style;
				}
				$sql = 'SELECT * FROM ' . THEMES_TABLE . ' WHERE themes_id = ' . (int) $board_config['default_style'];
				if ( !($result = $db->sql_query($sql)) )
				{
					message_die(CRITICAL_ERROR, 'Could not query database for theme info');
				}

				if ( $row = $db->sql_fetchrow($result) )
				{
					$db->sql_freeresult($result);
				}
				else
				{
					$style = $old_default_style;
					//message_die(CRITICAL_ERROR, "Could not get theme data for themes_id [$style]", '', __LINE__, __FILE__);
				}

				$sql = 'UPDATE ' . USERS_TABLE . '
					SET user_style = ' . (int) $board_config['default_style'] . "
					WHERE user_style = $style";
				if ( !($result = $db->sql_query($sql)) )
				{
					message_die(CRITICAL_ERROR, 'Could not update user theme info');
				}
			}
			else
			{
LINE 1010:		message_die(CRITICAL_ERROR, "Could not get theme data for themes_id [$style]", '', __LINE__, __FILE__);
			}
		}
	}[/code] The clue is in the IF: [code linenumbers=false]if ( !($row = $db->sql_fetchrow($result)) )[/code] In other words, if the row couldn't be queried from DB, try a number of things to change the theme settings, but, if the original query was relating to the default style, it means that default style couldn't be retrieved from DB, so then we have problems (there should always be a default style) - hence the error message on line 1010. So the question is why did mysql return an error? We come back my previous point, about the board default theme setting, that it contains an entry for a theme that doesn't exist.


