News:

SMF 2.1.6 has been released! Take it for a spin! Read more.

Main Menu

8: Undefined index: error

Started by Pieces, May 02, 2007, 04:29:04 PM

Previous topic - Next topic

Pieces

Hello all,

I am experiencing some problems with a theme picker I installed on my forum last week. I all of a sudden noticed my error log is filling up quickly with this error:

8: Undefined index: theme_options
File: /var/www/html/alphagamer/Sources/Load.php
Line: 156


The function in Load.php is the following one:

function theme_name(){
  global $db_prefix,$context,$scripturl;


$hidden_themeID = array('1', '2', '3', '4');

$resultaa=db_query("
        SELECT * from {$db_prefix}themes WHERE `variable` = 'name' ORDER by `value`", __FILE__, __LINE__);

while($rowaa=mysql_fetch_array($resultaa)){
$theme_rowa=$rowaa['ID_THEME'];

if(!in_array($rowaa['ID_THEME'], $hidden_themeID)){

$theme_row_namea=$rowaa['value'];
$context['theme_options']="".$context['theme_options']."<option value=\"$scripturl?theme=$theme_rowa\">$theme_row_namea</option>";
}
}
}


I am not (yet ;D) that familiar with php and arrays, so I am wondering if you guys(or girls) can take a look.

Thanks in advance.
Alphagamer: Game Discussion Blogs and Forum [nofollow]

Remaker

Try replacing your code with this one. I think it should fix it.


function theme_name(){
  global $db_prefix,$context,$scripturl;


$hidden_themeID = array('1', '2', '3', '4');

$resultaa=db_query("
        SELECT * from {$db_prefix}themes WHERE `variable` = 'name' ORDER by `value`", __FILE__, __LINE__);

while($rowaa=mysql_fetch_array($resultaa)){
$theme_rowa=$rowaa['ID_THEME'];

if(!in_array($rowaa['ID_THEME'], $hidden_themeID)){

$theme_row_namea=$rowaa['value'];
$context['theme_options']="".(isset($context['theme_options']) ? $context['theme_options'] : '' )."<option value=\"$scripturl?theme=$theme_rowa\">$theme_row_namea</option>";
}
}
}
Remaker - My blog

Pieces

Thanks Remaker, I think it worked.

Kind regards,

Pieces.
Alphagamer: Game Discussion Blogs and Forum [nofollow]

Advertisement: