Jump to content

[SOLVED] Ads after 2nd row


s4salman

Recommended Posts

I want to insert a 468x60 size banner after printing 2nd row using php. Currently 5 rows get printed on each page. Please help

 

Following is the script:

 

<?php
class Pager 
   { 
       function getPagerData($numHits, $limit, $page) 
       { 
           $numHits  = (int) $numHits; 
           $limit    = max((int) $limit, 1); 
           $page     = (int) $page; 
           $numPages = ceil($numHits / $limit); 

           $page = max($page, 1); 
           $page = min($page, $numPages); 

           $offset = ($page - 1) * $limit; 

           $ret = new stdClass; 

           $ret->offset   = $offset; 
           $ret->limit    = $limit; 
           $ret->numPages = $numPages; 
           $ret->page     = $page; 

           return $ret; 
       } 
   }  



    // get the pager input values 
    $page = $_GET['page']; 
    $limit = 15; 
    $result = mysql_query("select count(*) from 3gp"); 
    $total = mysql_result($result, 0, 0); 

    // work out the pager values 
    $pager  = Pager::getPagerData($total, $limit, $page); 
    $offset = $pager->offset; 
    $limit  = $pager->limit; 
    $page   = $pager->page; 

    // use pager values to fetch data 
    $query = "select * from 3gp order by id DESC limit $offset, $limit"; 
    $result = mysql_query($query); 

    // use $result here to output page content 


//my addition

//grab all the content

   //Custom Table Stsrt//
        $cols = 3; //number of coloms
        $i =1;
        echo "<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\" width=\"100%\" id=\"table1\" bordercolor=\"#E2E2E2\" bgcolor=\"#E2E2E2\">"
             ."<tr>";

while($r=mysql_fetch_array($result))
{	
   //the format is $variable = $r["nameofmysqlcolumn"];
   //modify these to match your mysql table columns
  
   $id=$r["id"];
   $name=$r["name"];
   $details=$r["details"];
   $url=$r["url"];
   $image=$r["image"];
   $mirririmg=$r["mirrorimg"];
  $mirror3gp=$r["mirror3gp"];
   
   
   //display the row
   
   
   
   $mybox = "$name
   <br>
   <img src='$image' width =\"90\" height =\"90\">
   <br>
   <a href='http://funxy.com/beta/3gp-download$id.html' class=\"classb\">Download This 3GP Video !</a>
   <br>";
   


                if (is_int($i / $cols)){
                    echo "<td width='180' align='center' style=\"border-style: dotted; border-width: 1\">$mybox</td></tr><tr>";
                }else{
                    echo "<td width='180' align='center' style=\"border-style: dotted; border-width: 1\">$mybox</td>";
                }
             $i++;
          //end if
       }//end while
       echo "</tr></table>";
       //Custom Table End//
   


//ends my addition



    // output paging system (could also do it before we output the page content) 
    if ($page == 1) // this is the first page - there is no previous page 
        echo "Previous"; 
    else            // not the first page, link to the previous page 
        echo "<a href=\"http://funxy.com/beta/3gp-videos-" . ($page - 1) . ".html\" id=\"navigationURL\">Previous</a>"; 

    for ($i = 1; $i <= $pager->numPages; $i++) { 
        echo " | "; 
        if ($i == $pager->page) 
            echo " $i"; 
        else 
            echo "<a href=\"http://funxy.com/beta/3gp-videos-$i.html\" id=\"navigationURL\"> $i</a>"; 
    } 

    if ($page == $pager->numPages) // this is the last page - there is no next page 
        echo "Next"; 
    else            // not the last page, link to the next page 
        echo "   <a href=\"http://funxy.com/beta/3gp-videos-" . ($page + 1) . ".html\" id=\"navigationURL\">Next</a>"; 
?> 

Link to comment
https://forums.phpfreaks.com/topic/151713-solved-ads-after-2nd-row/
Share on other sites

...
                if (is_int($i / $cols)){
                    echo "<td width='180' align='center' style=\"border-style: dotted; border-width: 1\">$mybox</td></tr><tr>";
                }else{
                    echo "<td width='180' align='center' style=\"border-style: dotted; border-width: 1\">$mybox</td>";
                }
             if ( $i / $cols == 2) echo "<td colspan='3'>BANNER HERE</td></tr><tr>";
             $i++;
          //end if

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.