Jump to content


Warning: Invalid argument supplied for foreach()

  • Please log in to reply
1 reply to this topic

#1 doodlebug

  • Members
  • PipPip
  • Member
  • 10 posts

Posted 05 April 2006 - 01:12 PM

Hi Board,

I'm afraid i'm pretty much a total newbie regarding php. I have aquired a link management script for which i can find no assistance with. I have installed it but i keep getting the following error message when i try to view the output page (links.php):

Warning: Invalid argument supplied for foreach() in /*******/local/home/****/loulousbijouterie.com/silver jewelry/FS_0930B/pages/linkman/links.php on line 44

The code for links.php is this:

error_reporting(E_ALL ^ E_NOTICE);

require "settings.php";

$lines = array ();

echo "<p class=\"linkman\">";

foreach ($lines as $thisline)
if (!empty($thisline)) {
if ($settings['clean'] != 1) {$url="go.php?url=".$url;}
echo "<a href=\"$url\" target=\"_new\" class=\"linkman\">$title</a> - $description<br>\n";

Line 44 is the 'foreach ($lines as $thisline)' line, but i can't see the problem.

Any ideas anyone??

#2 kenrbnsn

  • Staff Alumni
  • Advanced Member
  • 8,235 posts
  • LocationHillsborough, NJ, USA

Posted 05 April 2006 - 01:21 PM

After this line
<?php $lines=file($settings['linkfile']); ?>
add the debugging line
<?php echo '<pre>' . print_r($lines,true) . '</pre>'; ?>
to see whether the variable $lines is an array and what it contains.


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users