Results 1 to 3 of 3

Thread: display two ads images from mysql in left and right

  1. #1
    Join Date
    Jun 2008
    Posts
    121
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default display two ads images from mysql in left and right

    hi all

    i want to display two offer ads images in my php page. i am able to fetch data from mysql in my page. But the trouble is the script below displays the data in rows like one ad image above and second ad image below.
    i want to display one ad in left and second ad in its right. how is it possible.

    vineet

    <?php
    $qry="select * from special_offers order by offer_id";
    $result = mysql_query($qry);
    if(mysql_num_rows($result)>0)
    {
    while($row=mysql_fetch_array($result))
    {
    echo "<tr>";
    echo "<td valign=top>". "<img height=200 width=253 src='admin/uploads/" . $row['offer_image'] . "'/>" . "</td>";
    echo "</tr>";
    }
    }

    ?>
    Last edited by vineet; 10-20-2008 at 04:48 PM. Reason: make it more clear

  2. #2
    Join Date
    Apr 2006
    Posts
    190
    Thanks
    3
    Thanked 7 Times in 7 Posts

    Default

    try this

    PHP Code:
    <?php
    echo "<tr>";
    $qry="select * from special_offers order by offer_id";
    $result mysql_query($qry);
    if(
    mysql_num_rows($result)>0)
    {
    while(
    $row=mysql_fetch_array($result))
    {
    echo 
    "<td valign=top>""<img height=200 width=253 src='admin/uploads/" $row['offer_image'] . "'/>" "</td>";
    }
    }
    echo 
    "</tr>";
    ?>
    Ryan
    Sevierville, TN

  3. #3
    Join Date
    Jun 2008
    Posts
    121
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default insert two ads from mysql

    Quote Originally Posted by NXArmada View Post
    try this

    PHP Code:
    <?php
    echo "<tr>";
    $qry="select * from special_offers order by offer_id";
    $result mysql_query($qry);
    if(
    mysql_num_rows($result)>0)
    {
    while(
    $row=mysql_fetch_array($result))
    {
    echo 
    "<td valign=top>""<img height=200 width=253 src='admin/uploads/" $row['offer_image'] . "'/>" "</td>";
    }
    }
    echo 
    "</tr>";
    ?>
    hi

    thanks for the reply. it worked great.
    one thing more i would like to ask you that if i want to add
    PHP Code:
    echo "<td class=green_sep>""<img src='images/spacer.gif' width=15 height=2 />" "</td>"
    this is code that inserts a separator between two ads then this code ads separator after first ad and also after second ad. but i want only one separator between. means i dont want separator inserted again after second ad.

    vineet

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •