a1amattyj Posted May 30, 2008 Share Posted May 30, 2008 Hello, In my error log, its just plastered with: [30-May-2008 06:14:25] PHP Notice: Undefined offset: 2 in /home/smfnew/public_html/multi_operations/forum_functions.php on line 31 [30-May-2008 06:14:25] PHP Notice: Undefined offset: 2 in /home/smfnew/public_html/multi_operations/forum_functions.php on line 31 [30-May-2008 06:14:25] PHP Notice: Undefined offset: 2 in /home/smfnew/public_html/multi_operations/forum_functions.php on line 37 [30-May-2008 06:14:25] PHP Notice: Undefined offset: 2 in /home/smfnew/public_html/multi_operations/forum_functions.php on line 37 Line 31: if($serverhost[2] == 'smfnew' || $serverhost[2] == 'com'){ $forum_name = $forum_name1; }else{ $forum_name = ''.$forum_name1.'_2'; } Line 37: if($serverhost[2] == 'smfnew' || $serverhost[2] == 'com'){ $domain1 = 'smfnew.com'; }else{ $domain1 = 'smffree.net'; } Thanks! Link to comment https://forums.phpfreaks.com/topic/107999-error-log-php-notice-undefined-offset/ Share on other sites More sharing options...
rajivgonsalves Posted May 30, 2008 Share Posted May 30, 2008 well it just means that the offset is not set try using isset to avoid the error if(isset($serverhost[2]) && ($serverhost[2] == 'smfnew' || $serverhost[2] == 'com')){ $domain1 = 'smfnew.com'; }else{ $domain1 = 'smffree.net'; } Link to comment https://forums.phpfreaks.com/topic/107999-error-log-php-notice-undefined-offset/#findComment-553519 Share on other sites More sharing options...
Sulman Posted May 30, 2008 Share Posted May 30, 2008 Ok...well the offset is in reference to the "2" that you are using in your array ($serverhost[2]). So this error is telling you that there is no element 2 in the serverhost array. Try printing the array using print_r() to see what is in it. Link to comment https://forums.phpfreaks.com/topic/107999-error-log-php-notice-undefined-offset/#findComment-553524 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.