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?? Link to comment https://forums.phpfreaks.com/topic/6653-warning-invalid-argument-supplied-for-foreach/ 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 Link to comment https://forums.phpfreaks.com/topic/6653-warning-invalid-argument-supplied-for-foreach/#findComment-24172 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.