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
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...

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.