doodlebug Posted April 5, 2006 Share Posted April 5, 2006 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 44The code for links.php is this:error_reporting(E_ALL ^ E_NOTICE);require "settings.php";require_once("header.txt");$lines = array ();$lines=file($settings['linkfile']);echo "<p class=\"linkman\">";foreach ($lines as $thisline){ $thisline=trim($thisline); if (!empty($thisline)) { list($name,$email,$title,$url,$recurl,$description)=explode($settings['delimiter'],$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?? Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted April 5, 2006 Share Posted April 5, 2006 After this line [code]<?php $lines=file($settings['linkfile']); ?>[/code] add the debugging line [code]<?php echo '<pre>' . print_r($lines,true) . '</pre>'; ?>[/code] to see whether the variable $lines is an array and what it contains.Ken Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.