MPAA - Credit Cards - Loans - Shares - Student Loans and Credit

PDA

View Full Version : How can i do this?


srobona
Jan 27th 2008, 10:05 pm
Hello friends,

I need a solution for this:

Suppose i have got 20 links from a query to display them in a column like

link 1
link2
link3
.....
.....
link20

No problem up to this portion. But now i want to show a google ad after every 5th link like

link1
.....
link5
google ad here

link6
.....
link10
google ad here

link11
.....
link15
google ad here

link16
.....
link20
google ad here

Any idea or solution? Thanks in advance :)

Alam
Jan 27th 2008, 11:22 pm
You can Try-

<?
$sl=1;
for($a=1;$a<=23; $a++)
{
echo $a."<br>";
if(($sl/5)!=(is_float($sl/5)))
{
echo "Your Google Ad Here<br>";
}
$sl=$sl+1;
}
?>

if fulfill your requirement, plz apply green repu ;)

kreoton
Jan 27th 2008, 11:41 pm
<?php
$counter = 0;
foreach ($yourlinks as $link)
{
echo $link.'<br />';
$counter++;
if ($counter%5 == 0)
echo $google_ad_code;
}
?>

srobona
Jan 30th 2008, 3:25 am
Thanks a lot for the solution :) rep added