I cant get the text to move to the left??

Discussion in 'Programming' started by Kurt Whittingham, May 20, 2012.

  1. #1
    Hello, im trying to get the text to move right next to the image but it wont work..

    this is the page im talking about http://www.motorbikecentral.com/Interviews/Interviews.php

    this is the code im using
    <?php
    
        require('connect.php');
        
        $result = mysql_query("SELECT * FROM articles WHERE category_id='7' ORDER BY article_id DESC ")
        or die(mysql_error());  
       
        echo "<table width='100%' cellspacing='0'>";
        // keeps getting the next row until there are no more to get
        while($row = mysql_fetch_array( $result )) {
        // Print out the contents of each row into a table
        echo "<tr><td>";
        // image
        echo '<img name="myimage" src=' . $row['image'] . ' width="120" height="80" />';
        // article name
        echo "</td><td style='vertical-align:top'>";
        echo '<p><a style="font-size: 16px" href="'. $row['url'] .'">'. $row['article_name'] .'</a>'; echo "<br />";
        // author + date
        echo "<small>";
        echo "<b>AUTHOR : &nbsp;</b>"; echo $row['author']; echo"&nbsp;&nbsp;<img src='menuvertline.gif' style='vertical-align:center' width='2' height='10'> &nbsp;&nbsp;"; echo "<b>DATE POSTED: &nbsp;</b>"; echo $row['posted']; echo "<br />";
        echo "</small><br /><br />";
        echo "</td></tr>";
    }
    
    ?>
    PHP:
     
    Solved! View solution.
    Kurt Whittingham, May 20, 2012 IP
  2. kids

    kids Active Member

    Messages:
    411
    Likes Received:
    4
    Best Answers:
    2
    Trophy Points:
    68
    #2
    I really don't understand what you need? You can tell us more clearly? But I think you change structure table to div, it will be better for your loop.
     
    kids, May 20, 2012 IP
  3. Kurt Whittingham

    Kurt Whittingham Member

    Messages:
    151
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    46
    #3
    ive never used Div,

    and to be more clear. i want the Link and text to be right next to the image
     
    Kurt Whittingham, May 20, 2012 IP
  4. #4
    I have viewed your code and you can try this
    
    <?php
    
        require('connect.php');
       
        $result = mysql_query("SELECT * FROM articles WHERE category_id='7' ORDER BY article_id DESC ")
        or die(mysql_error());  
       
        echo "<table width='100%' cellspacing='0' cellpadding='5'>";
        // keeps getting the next row until there are no more to get
        while($row = mysql_fetch_array( $result )) {
        // Print out the contents of each row into a table
        echo "<tr><td width='130'>";
        // image
        echo '<img name="myimage" src=' . $row['image'] . ' width="120" height="80" />';
        // article name
        echo "</td><td style='vertical-align:top;text-align:left;' width='99%'>";
        echo '<p><a style="font-size: 16px" href="'. $row['url'] .'">'. $row['article_name'] .'</a>'; echo "<br />";
        // author + date
        echo "<small>";
        echo "<b>AUTHOR : &nbsp;</b>"; echo $row['author']; echo"&nbsp;&nbsp;<img src='menuvertline.gif' style='vertical-align:center' width='2' height='10'> &nbsp;&nbsp;"; echo "<b>DATE POSTED: &nbsp;</b>"; echo $row['posted']; echo "<br />";
        echo "</small><br /><br />";
        echo "</td></tr>";
    }
    
    ?>
    
    PHP:
     
    kids, May 21, 2012 IP
  5. NetStar

    NetStar Notable Member

    Messages:
    2,471
    Likes Received:
    541
    Best Answers:
    21
    Trophy Points:
    245
    #5
    Been a while since I have seen someone laying out a page with TABLES... CSS would make your life a lot easier plus produce cleaner code.
     
    NetStar, May 21, 2012 IP
  6. Kurt Whittingham

    Kurt Whittingham Member

    Messages:
    151
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    46
    #6
    ive only been coding for about 2 years, and sorta just learnt html then css. i think i would take so long to change it all now :(
     
    Kurt Whittingham, May 21, 2012 IP
  7. NetStar

    NetStar Notable Member

    Messages:
    2,471
    Likes Received:
    541
    Best Answers:
    21
    Trophy Points:
    245
    #7
    I started back in the 90's where every web page has a series of nested tables with in nested tables with in nested tables etc. When CSS support started to become more common I *figured* it would take too much of my time to learn CSS so I continued to ignore learning it. Finally one rainy day I decided to play around with it. With in a couple hours I was able to do most things people use CSS for to layout a page. Ever since then my development time has been greatly decreased and my HTML code is much smaller and no longer a headach to update. With CSS you can create changes to your entire layout by touching one file as appose to using tables which must be on every page. I absolutely suggest taking an afternoon to learn basic CSS. It will make your life easier and you will look back at using tables and say "geesh...I can't believe I use to waste my time designing table layouts"
     
    NetStar, May 21, 2012 IP
  8. Kurt Whittingham

    Kurt Whittingham Member

    Messages:
    151
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    46
    #8
    okay, if i did this, i would have to work for a couple weeks changing all the pages wouldnt i??
     
    Kurt Whittingham, May 22, 2012 IP
  9. NetStar

    NetStar Notable Member

    Messages:
    2,471
    Likes Received:
    541
    Best Answers:
    21
    Trophy Points:
    245
    #9
    Who knows.
     
    NetStar, May 22, 2012 IP
  10. Kurt Whittingham

    Kurt Whittingham Member

    Messages:
    151
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    46
    #10
    so you highly recommend me getting my skills good in css, then re designing the site?
     
    Kurt Whittingham, May 22, 2012 IP
  11. NetStar

    NetStar Notable Member

    Messages:
    2,471
    Likes Received:
    541
    Best Answers:
    21
    Trophy Points:
    245
    #11
    Using CSS requires less HTML code and more control over the design. With CSS you can change an entire layout on a website without editing each page. With that said alone I highly recommend learning CSS. In fact, using CSS is the standard for designing today.

    I would redo your website if you plan on updating it. It sounds to me that you are still creating it. How many pages is it?
     
    NetStar, May 24, 2012 IP
  12. Kurt Whittingham

    Kurt Whittingham Member

    Messages:
    151
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    46
    #12
    I have about 100-150 pages
     
    Kurt Whittingham, May 24, 2012 IP