Jump to content

[SOLVED] PHP list question...


cowboysdude

Recommended Posts

This is what I"m using and it works great until I add $n_time to the list variable set then I get this error...

 

"Undefined offset: etc..etc.." 

 

Take out the $n_time variable and the error goes away.. suggestions? 

 

 

$lines = file('modules/mod_norven/edit/files.txt', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
foreach($lines as $n_line)
{
    list($n_id, $n_vid, $n_pic, $n_title) = explode('-', $n_line);
echo '<li><a href="'.$n_url.'/'.$n_path.'/'.$n_vid.'" id="mb'. $n_id.'" class="mb" ><IMG class=Tips4 title="'.$n_time.'::'.$n_title.'" src="'.$n_url.'/modules/mod_norven/images/vidimg/'. $n_pic .'" border="0" width="60" Height="60" ></a></li>';
}
?>

 

Thanks in advance!!!

Link to comment
https://forums.phpfreaks.com/topic/180928-solved-php-list-question/
Share on other sites

You're not defining $n_time within your list: list($n_id, $n_vid, $n_pic, $n_title) = explode('-', $n_line);

 

Add it if you know how, or show us the structure of $n_line.

 

It's above as this..

 

list($n_id, $n_vid, $n_pic, $n_title) = explode('-', $n_line);

 

except I would have added this...

 

list($n_id, $n_vid, $n_pic, $n_title, $n_time) = explode('-', $n_line);

and when I do that is when I get the offset error..

 

I pasted the entire code above... that is all that is between the <? and ?> lines...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.