papaface Posted April 10, 2007 Share Posted April 10, 2007 Hello, I have a script: <table width="550" style="height:100% " border="0" cellspacing="0" cellpadding="0"> <tr> <td valign="top" > <div style="margin:10px 0px 10px 18px; "> <img src="/images/tx3.gif" alt="Construction Companies List"><br> <div style="margin:14px 22px 0px 3px; "> <img src="/images/pic1.jpg" alt="Construction Company Directory" style="margin-right:11px; " align="left"><img src="images/a.gif" alt="Find Contractor" style="margin-right:6px; " class="m"><strong>Find Reputable Contractors and Construction Services</strong><br> ContractorRolodex is the largest free directory of construction companies and related services available on the web. Consumers can find local companies to help with construction projects by browsing our directory. <br><br> Read and write reviews about the companies you have worked with in the past to help others make a wiser decision. Contractors can use our directory to find services, stores, outlets and partners in your area as well. Our free directory is a valuable time saver when it comes to your next project.<br><p>Submission is free to our new online directory of contractors in the united states, and takes 2 minutes to complete the online registration form. Adding your business to our directory will gain you more exposure and let more people review your business and also proive directions for visitors loking for your company.</p><br><br> </div> </div> </td> </tr> <tr> <td valign="top"> <div style="margin:10px 0px 2px 18px; "> <img src="/images/bystate.gif" alt="Construction Company list"><br><br> <table cellpadding="1" cellspacing="2" width="100%"> <tr> <td width="50%" valign="top"> <? $AllStates = $Listings->getStatesList(); $x = 0; foreach ($AllStates as $AllState) { $x ++; if ($x==round(count($AllStates)/2)+1) { echo "</td><td width='50%' valign='top'>";} ?> <div style="padding-bottom:3px"> <div style="float:left"><img src="/images/a1.gif" style="padding-top:3px; padding-bottom:6px; padding-right:4px" alt="<?=$AllState->state;?> contractors" /> </div><a href="/contractors/state/<?=strip(getLongState($AllState->state));?>.html" title="Browse All Construction Listings in <?=$AllState->state;?>"><?=iif($AllState->state=="DC", "D.C.", ucwords(strtolower(getLongState($AllState->state))));?></a> <span style="color:#990000; background-color:#F5F5F5"><small>[<?=number_format($AllState->AllCount);?> Contractors]</small></span> </div> <? } ?> </td> </tr> </table> </div> </td> </tr> <tr> <td valign="top"> <div style="margin:10px 0px 2px 18px; "> <img src="/images/service.gif" alt="Construction Companies List"><br><br> <table cellpadding="1" cellspacing="2" width="100%"> <tr> <td width="50%" valign="top"> <? $AllCats = $Listings->getChildCats(1); $x = 0; foreach ($AllCats as $AllCat) { $x ++; if ($x==round(count($AllCats)/2)) { echo "</td><td width='50%' valign='top'>";} ?> <div style="padding-bottom:3px; background:url(/images/l.gif) bottom repeat-x"> <a href="/contractors/category/<?=$AllCat->id;?>_<?=strip($AllCat->cat);?>.html"><?=$AllCat->cat;?></a> <span style="color:#990000; background-color:#F5F5F5"><small>[<?=number_format($AllCat->records);?>]</small></span> </div> <div style="padding-top:2px"></div> <? } ?> </td> </tr> </table> </div> </td> </tr> </table> There is an error on line 24 which is: <? $AllStates = $Listings->getStatesList(); $x = 0; foreach ($AllStates as $AllState) { //LINE 24 $x ++; if ($x==round(count($AllStates)/2)+1) { echo "</td><td width='50%' valign='top'>";} ?> Could someone tell me what is causing this issue? Any help will be appreciated. regards Link to comment https://forums.phpfreaks.com/topic/46478-script-error/ Share on other sites More sharing options...
kenrbnsn Posted April 10, 2007 Share Posted April 10, 2007 What is the error? Ken Link to comment https://forums.phpfreaks.com/topic/46478-script-error/#findComment-226091 Share on other sites More sharing options...
papaface Posted April 10, 2007 Author Share Posted April 10, 2007 oops sorry lol. I thought i mentioned Warning: Invalid argument supplied for foreach() in *** on line 24/ Link to comment https://forums.phpfreaks.com/topic/46478-script-error/#findComment-226094 Share on other sites More sharing options...
kenrbnsn Posted April 10, 2007 Share Posted April 10, 2007 Is the variable $AllStates an array? Ken Link to comment https://forums.phpfreaks.com/topic/46478-script-error/#findComment-226104 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.