+ Reply to Thread
Results 1 to 2 of 2

Thread: Warning: Invalid argument supplied for foreach() in***holder.php on line 108

  1. #1
    rana99 is offline x10Hosting Member rana99 is an unknown quantity at this point
    Join Date
    Apr 2010
    Posts
    6

    Warning: Invalid argument supplied for foreach() in***holder.php on line 108

    Warning: Invalid argument supplied for foreach() in***holder.php on line 108
    Here is the complete code.
    1. <LI class=codeLI><?php <LI class=codeLI> <LI class=codeLI>// ****: holder.php - v. 5.03 <LI class=codeLI> <LI class=codeLI> <LI class=codeLI> // PRELIMINARIES: <LI class=codeLI> <LI class=codeLI> // Get Includes: <LI class=codeLI> <LI class=codeLI> // Determine mode: <LI class=codeLI> $testmode=FALSE; <LI class=codeLI> if (substr(strtolower($_GET['test']),0,1)=='y') $testmode=TRUE; <LI class=codeLI> <LI class=codeLI> // Determine locale: <LI class=codeLI> $in=strtolower($_GET['in']); <LI class=codeLI> if ($in!='us' && $in!='uk' && $in!='ca' && $in!='de' && $in!='fr' && $in!='jp') $in=NULL; // will assign in freebie.php <LI class=codeLI> if (get_magic_quotes_gpc()==FALSE) {$ltr=urldecode($_GET['ltr']);} else {$ltr=$_GET['ltr'];} <LI class=codeLI> if (ctype_alpha($ltr)===FALSE) $ltr='@'; // prevent faked direct-URL hijinks <LI class=codeLI> $ltr=strtoupper(substr($ltr,0,1)); // allow multi-character input data <LI class=codeLI> $showltr='the letter '.$ltr; <LI class=codeLI> if ($ltr==='@') $showltr='a Numeral or Other Non-Alphabetic Character'; <LI class=codeLI> <LI class=codeLI> // Call includes: <LI class=codeLI> // (order here is crucial!) <LI class=codeLI> include('timer.php'); // could replace page with overuse message <LI class=codeLI> require('freebie.php'); <LI class=codeLI> <LI class=codeLI> <LI class=codeLI> // Set Letter-File Spec: <LI class=codeLI> $dropinfile=$bookpagespath.'dropins-'.$ltr.$dot.$in; <LI class=codeLI> <LI class=codeLI> <LI class=codeLI> // Send headers: <LI class=codeLI> // (must be done HERE!) <LI class=codeLI> expiry($dropinfile); <LI class=codeLI> headout(); // language & character-set <LI class=codeLI> <LI class=codeLI> <LI class=codeLI> <LI class=codeLI> // PAGE: <LI class=codeLI> <LI class=codeLI> // Send Pagetop: <LI class=codeLI> echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'.$crlf; <LI class=codeLI> echo '<html>'.$crlf; <LI class=codeLI> echo '<head>'.$crlf; <LI class=codeLI> echo ' <title>New Books About '.$oneq.$keytext.$oneq.' from ***'.$national.', Title Begins With '.$showltr.'</title>'.$crlf; <LI class=codeLI> echo ' <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />'.$crlf; <LI class=codeLI> echo ' <meta name="description" content="Books about '.$oneq.$keytext.$oneq.' available new from ***'.$national.' whose titles begin with '.$showltr.'." />'.$crlf; <LI class=codeLI> echo ' <meta name="keywords" content="'.$keytext2.', books, bookshop, book shop, bookstore, book store" />'.$crlf; <LI class=codeLI> echo ' <meta name="robots" content="noodp">'.$crlf; <LI class=codeLI> echo $iconline.$crlf; <LI class=codeLI> echo ' <script language="JavaScript" type="text/JavaScript">if (parent.frames.length > 0) top.location.replace(document.location);</script>'.$crlf; <LI class=codeLI> echo '</head>'.$crlf; <LI class=codeLI> echo '<body text="#000000" link="#cc0000" vlink="#6666ff" bgcolor="#'.$border.'" style="font-family:'.$pagefontfamily.'">'.$crlf; <LI class=codeLI> echo $crlf; <LI class=codeLI> echo '<h1 align="center"><font color="#'.$headlinetext.'"><big>"'.$keytext2.'" Books Available New: Titles Beginning With '.$showltr.'</big></font></h1>'.$crlf; <LI class=codeLI> echo $crlf; <LI class=codeLI> echo '<table width="98%" align="center" cellspacing="0" cellpadding="20" border="'.(2+$blockborder).'" rules="none" frame="box" bgcolor="#'.$mainbkground.'">'.$crlf; // border -> rules <LI class=codeLI> // (last-updated row) <LI class=codeLI> if (is_file($dropinfile)!==FALSE) <LI class=codeLI> { <LI class=codeLI> echo ' <tr>'.$crlf; <LI class=codeLI> echo ' <td align="right">'.$crlf; <LI class=codeLI> echo ' <font size="-2" color="#666666">'.$crlf; <LI class=codeLI> echo ' List last updated '.gmdate('D, d M Y H:i:s \G\M\T',filemtime($dropinfile)); <LI class=codeLI> echo ' </font>'.$crlf; <LI class=codeLI> echo ' </td>'.$crlf; <LI class=codeLI> echo ' </tr>'.$crlf; <LI class=codeLI> } <LI class=codeLI> echo ' <tr>'.$crlf; <LI class=codeLI> echo ' <td>'.$crlf; <LI class=codeLI> <LI class=codeLI> <LI class=codeLI> // Process Template: <LI class=codeLI> $html=bringme('hold.htm'); <LI class=codeLI> <LI class=codeLI> // Fix file on the fly: <LI class=codeLI> foreach ($html as $line) <LI class=codeLI> { <LI class=codeLI> $line=trim($line); <LI class=codeLI> // (page-specific data) <LI class=codeLI> $line=str_replace('@@@',$keytext,$line); <LI class=codeLI> $line=str_replace('~~~',$keytext2,$line); <LI class=codeLI> $line=str_replace('^^^',$showltr,$line); <LI class=codeLI> // (***) <LI class=codeLI> $line=str_replace('***.com','*** '.$national,$line); <LI class=codeLI> // (package directory) <LI class=codeLI> $line=str_replace('***',$freeburl,$line); <LI class=codeLI> // (call to self) <LI class=codeLI> $line=str_replace('HOLDERPHP',$freeburl.'holder.ph p?in='.$in.'&amp;ltr',$line); <LI class=codeLI> // (favicon) <LI class=codeLI> if (strpos($line,'FAVICONLINK')!==FALSE) $line=$iconline; <LI class=codeLI> // (Google AdSense) <LI class=codeLI> if (strpos($line,'ADSENSEDROPIN')!==FALSE) <LI class=codeLI> { <LI class=codeLI> $start=1+strpos($line,'#'); <LI class=codeLI> $cut=strpos($line,$blank,$start); <LI class=codeLI> $refnum=substr($line,$start,$cut-$start); <LI class=codeLI> $adsense=bringme('adsense'.$refnum.'.php'); <LI class=codeLI> foreach ($adsense as $codeline) <LI class=codeLI> {echo $codeline;} <LI class=codeLI> $line=NULL; <LI class=codeLI> } <LI class=codeLI> // (titles-list table data) <LI class=codeLI> if (strpos($line,'PUTDROPINHERE')!==FALSE) <LI class=codeLI> { <LI class=codeLI> $titles=bringme($dropinfile); <LI class=codeLI> foreach ($titles as $title) <LI class=codeLI> {echo $title;} <LI class=codeLI> $line=NULL; <LI class=codeLI> } <LI class=codeLI> echo $line.$crlf; <LI class=codeLI> } // all .htm file lines <LI class=codeLI> <LI class=codeLI> <LI class=codeLI> // Send Pagebottom: <LI class=codeLI> echo ' <br/>'.$crlf; <LI class=codeLI> echo ' </td>'.$crlf; <LI class=codeLI> echo ' </tr>'.$crlf; <LI class=codeLI> echo '</table>'.$crlf; <LI class=codeLI> echo $crlf; <LI class=codeLI> echo '<p align="center"><a href="'.$freeburl.'book-search.php?in='.$in.'">Search *** for <em>any</em> new book.</a></p>'.$crlf; <LI class=codeLI> echo '<p align="center"><a href="'.$freeburl.$myshop.'?in='.$in.'">Return to this book shop\'s "front door" page.</a></p>'.$crlf; <LI class=codeLI> echo '<hr />'.$crlf; <LI class=codeLI> echo $crlf; <LI class=codeLI> spill(bringme('rollyourown.php')); <LI class=codeLI> echo $crlf; <LI class=codeLI> @include('runcoopads.php'); <LI class=codeLI> echo $crlf; <LI class=codeLI> echo '<br/>'.$crlf; <LI class=codeLI> spill(bringme('ganalytics.php')); <LI class=codeLI> echo '</body>'.$crlf; <LI class=codeLI> echo '</html>'.$crlf;
    ?>














  2. #2
    misson is offline x10 Spammer misson is a jewel in the rough
    Join Date
    Mar 2008
    Location
    Libertatia
    Posts
    2,506

    Re: Warning: Invalid argument supplied for foreach() in***holder.php on line 108

    Please don't throw all your code up (read that link; it's very important) in a post, especially without formatting it. It's completely unreadable. Create a minimal test case, indent it properly, and use [php], [html] or [code] tags (as appropriate) to delineate and format the code, and indicate which line is referred to in the error. As it is, we have no way of telling which line is line 108.

    An "Invalid argument supplied for foreach" means you've using something that isn't traversable in a foreach–what you think is an array or PDO result isn't.
    Last edited by misson; 05-03-2010 at 07:18 AM.
    Be sure to read all pages linked in this post; they have further information that should prove useful. When asking for help, make sure you follow Eric Raymond's and Jon Skeet's guidelines for prompt, accurate responses. Please answer any questions I ask; they're not rhetorical (probably). Any posted code is intended as illustrative example, rather than a solution to your problem to be copied without alteration. Study it to learn how to write your own solution.
    Misson, not Mission.

+ Reply to Thread

Similar Threads

  1. Replies: 4
    Last Post: 04-23-2010, 02:38 AM
  2. Replies: 9
    Last Post: 10-28-2009, 05:35 PM
  3. Invalid argument supplied for foreach()
    By Jesse in forum Programming Help
    Replies: 10
    Last Post: 08-29-2009, 10:40 AM
  4. Supplied Argument not valid
    By zyreena in forum Programming Help
    Replies: 7
    Last Post: 05-21-2009, 01:06 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers