Jump to content

sql display question ???


imarockstar

Recommended Posts

 

 

I have this page that displays 6 boxes of information to which is pulled from my sql database. This is working fine, however, I need to add a small piece of html code to the end of every 3 boxes to that the boxes will continue on the next line.

 

the code that I need to add is  <br class=clear>. This needs to go after every 3rd box.

 

I am not sure on how to write this into my php ..

 

here is the page to where you can see the boxes.

http://74.55.14.226/~green/index.php

 

 

here is my current code

 

<?php

// Retrieve data from database 
$sql="SELECT * FROM homeblocks";
$result=mysql_query($sql);

// Start looping rows in mysql database.
while($rows=mysql_fetch_array($result)){
?>





<div class='box boxpadright'>
<h2 class='boxtitle'><? echo $rows['title']; ?></h2>
<a href='<? echo $rows['link']; ?>'><? echo $rows['text']; ?></a>
</div>	<!-- box -->





<? } mysql_close(); ?>

 

 

basically I need the output to look like this ..

 

 

box      box      box

 

line break

 

box      box      box

 

 

:) thanks

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/132144-sql-display-question/
Share on other sites

A side note, tables are a thing of the past with this new "Web 2.0" The only issue with Web 2.0 and why tables are still used today is because of compatibility. Tables will display how they should on any browser, using CSS to design a site say in Firefox will look differently in IE. Mainly because IE thinks that it can use it's own rules.

 

It is nearly impossible to get both of them to work, it takes alot of different hacks etc to make them look right and if you do not know which browser does it, it is near impossible. I prefer to use CSS to design my tables, but man it is a pain to get working across with IE having it's own rules and not wanting or going to change that.

Link to comment
https://forums.phpfreaks.com/topic/132144-sql-display-question/#findComment-686833
Share on other sites

I disagree, tables should be used for tabular data. Not using tables for tabular data is like trying to stack non-bold text in such a way as to make it appear bold. Yes, you can do it, but why do it that way if there's already a method made to do it easily. Of course you shouldn't use tables for layouts, that's a given, but people who say you should never ever use tables under any circumstances either don't know what they're doing, they're misinformed, or they're a masochist.

Link to comment
https://forums.phpfreaks.com/topic/132144-sql-display-question/#findComment-686869
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.