Solarpitch Posted June 11, 2007 Share Posted June 11, 2007 Hey Guys, I am trying to achieve the layout in the below image. I kinda have it correct but not really! Seems to be messing up a bit more than I expected. Bascially I am looking to format the box's with the text inside and the 10px padding between then like below. echo "<table width='700' border='0' cellpadding='0' cellspacing='0'>"; while($row = $result->fetch_assoc()) { echo " <tr > <div class='table_style'> <td width = 46 align='center' valign='middle'><img src=".$camera_image." style= border='1px' width='40' height='40' /></td> <td width = 100 align='left'>". $row['header'] ."</td> <td width = 50 align='left'>" . $row['make'] . "</td> <td width = 50 align='left'>" . $row['county'] . "</td> <td width = 40 align='left'>" . '€' . $row['price'] . "</td> <td width = 40 align='left'><a href=\"view_ad.php?ad_id=". $row['ad_id'] ."\">View Ad</a></td> </div> </tr> "; } echo " </table>"; ****************************************** Stylesheet .table_style { font-family:Arial; font-size:13px; color:#303030; height:55px; border-bottom-style:solid; border-bottom-color:#D9D9D9; border-bottom-width:1px; border-top-style:solid; border-top-color:#D9D9D9; border-top-width:1px; border-left-style:solid; border-left-color:#D9D9D9; border-left-width:1px; border-right-style:solid; border-right-color:#D9D9D9; border-right-width:1px; } .table_style:hover { border: 1px solid #98C83C; } Link to comment https://forums.phpfreaks.com/topic/55135-php-formatting-db-output-in-loop/ Share on other sites More sharing options...
Psycho Posted June 11, 2007 Share Posted June 11, 2007 Build the HTML to be displayed how you want it and then build the PHP to replicate that. I suspect your issue is an HTML/CSS issue not PHP. By the way, I don't think you can use a div like that outside of TD's. Link to comment https://forums.phpfreaks.com/topic/55135-php-formatting-db-output-in-loop/#findComment-272571 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.