SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Addict
    Join Date
    Jun 2007
    Location
    Plymouth uk
    Posts
    313
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question can any one convert this to use tables

    i have this cose to display an image and some text but dosnt line up very well some one told me to use tables
    and i dont have a clue
    any help please
    would like the image in 1 box and all text in another box side by side if you see what i mean

    PHP Code:
    //Puts it into an array 
    while($info mysql_fetch_array$data )) 

    //Outputs the image and other data
    Echo "<img src=http://www.tiles.com/uploads/".$info['pic'] ." alt=\"Image\" align=\"left\" width=\"100px\" height=\"100px\" hspace=\"10px\" vspace=\"8px\"> <br>";
    Echo 
    "<b>Name:</b> ".$info['name'] . " <br>";
    Echo 
    "<b>Description:</b> ".$info['desc'] . " <br>";
    Echo 
    "<b>Availability:</b> ".$info['avail'] . " <br/>";
    Echo 
    "<hr>";
    }

    ?> 
    cheers
    Doug
    Last edited by dougvcd; Jun 21, 2009 at 11:45. Reason: more info
    an old man of 60 trying to keep up with the youngsters he he
    http://lostpetsplymouth.net16.net

  2. #2
    SitePoint Enthusiast
    Join Date
    May 2003
    Location
    Nova Scotia, Canada
    Posts
    44
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This should be what your looking for:

    Code:
    //Puts it into an array 
    echo '<table border="0" cellspacing="0" cellpadding="4">';
    while($info = mysql_fetch_array($data))  { 
    
    //Outputs the image and other data
    echo "<tr><td colspan="2"><img src=http://www.tiles.com/uploads/".$info['pic'] ." alt=\"Image\" align=\"left\" width=\"100px\" height=\"100px\" hspace=\"10px\" vspace=\"8px\"></td></tr>";
    echo "<tr><td><b>Name:</b></td><td>".$info['name'] . "</td></tr>";
    echo "<tr><td><b>Description:</b></td><td>  ".$info['desc'] . "</td></tr>";
    echo "<tr><td><b>Availability:</b></td><td> ".$info['avail'] . "</td></tr>";
    echo "<tr><td colspan="2"><hr></td></tr>";
    
    }
    echo '</table>';
    ?>

  3. #3
    Theoretical Physics Student bronze trophy Jake Arkinstall's Avatar
    Join Date
    May 2006
    Location
    Lancaster University, UK
    Posts
    7,062
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Tables are a great way to layout your content... if you're in the 1990s.

    Some simple CSS could easily solve your problems. Want to get this moved to the CSS forum so you can find a real solution?

    That 'friend' of yours either dislikes you or knows too little about design - either way, it's not a good idea to listen to his advice.

    Something like this, maybe?
    PHP Code:
    while($info mysql_fetch_array$data )){
        Echo <<<HTML
        <img src="http://www.tiles.com/uploads/{$info['pic']}" alt="Image" style="width: 100px; height: 100px; margin: 8px;">
        <ul style="float: right; display: block;">
            <li><b>Name:</b> 
    {$info['name']}</li>
            <li><b>Description:</b> 
    {$info['desc']}</li>
            <li><b>Availability:</b> 
    {$info['avail']}</li>
        </ul>
    HTML;

    Jake Arkinstall
    "Sometimes you don't need to reinvent the wheel;
    Sometimes its enough to make that wheel more rounded"-Molona


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
  •