Re: [virgodesign] Strange Blog Results... Help^^
Hi Dave,
I'm having another issue, and I am wondering if its the same issue - even though I have removed the 'where' => whereRecordNumberInUrl(1),
Warning: Invalid argument supplied for foreach() in includes/ads_250x80.php on line 12
This error only happens if no ads are in the record (or all hidden). But if there are ads in that record it displays fine. Any ideas off the top of your head ??
Here is the code:
<?php
require_once "cms/lib/viewer_functions.php";
list($ads_380x200Records, $ads_380x200MetaData) = getRecords(array(
'tableName' => 'ads_380x200',
//'where' => whereRecordNumberInUrl(1),
'orderBy' => 'RAND()',
'limit' => '1',
));
$ads_380x200Record = @$ads_380x200Records[0]; // get first record
?>
<!--Ads 380x200 -->
<div id="ad_block" class="block2">
<?php foreach ($ads_380x200Record['ad_upload'] as $upload): ?>
<?php if ($upload['isImage']): ?>
<a href="<?php echo $ads_380x200Record['url'] ?>" target="_blank"><img src="<?php echo $upload['urlPath'] ?>" width="<?php echo $upload['width'] ?>" height="<?php echo $upload['height'] ?>" title="<?php echo $ads_380x200Record['sponsor'] ?>" alt="<?php echo $ads_380x200Record['sponsor'] ?>" /></a>
<?php endif ?>
<?php endforeach ?>
<?php if (!$ads_380x200Record): ?>
<a href="advertise.php"><img src="images2/spacer.gif" width="380" height="200" /></a>
<?php endif ?>
</div>