Jump to content

PHP formatting DB output in loop?


Solarpitch

Recommended Posts

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;

}

 

 

example_3.gif

Link to comment
https://forums.phpfreaks.com/topic/55135-php-formatting-db-output-in-loop/
Share on other sites

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.