Page 1 of 1

array key exists problem with a loop

Posted: Wed Feb 28, 2007 6:30 am
by xcow
edit// sry i edited the page cause the php code was the wrong one
edit2// sry, this has been solved. thanks =p

Code: Select all

function read($file,$startNo=0) {
		global $xf_root_path,$xf_config_global_extention,$xf_config_postsystem_posts_per_page,$xf_dir_postlogs;
		$filename = $file.$xf_config_global_extention;
		$fullpath = $xf_root_path.$xf_dir_postlogs.$filename;
		
		$linesx = file($fullpath);
		$lines = array_reverse($linesx);
		
		
		
		while (list($key,$value) = each($lines)) {
			if (($key >= $startNo) && ($key < ($startNo+$xf_config_postsystem_posts_per_page))) {
				$output[$key] .= $value;
			}
		}
		
		return $output;
	}
that is my function for getting back x number of posts. But i keep getting UNDEFINED OFFSET errors.. any help appreciated

-thanks

Posted: Wed Feb 28, 2007 6:38 am
by ryuuka
i'm guessing that $key or $value or $lines isn't an array and that one of these needs to be an array