michaeljp64 Posted July 5, 2010 Share Posted July 5, 2010 <?php mysql_connect('localhost','michael','demo123') or die(mysql_error()); mysql_select_db("fruit")or die(mysql_error()); $query = "SELECT * FROM stuff"; $result = mysql_query($query)or die(mysql_error()); print '<table border="1">'; $counter = 0; $cells_per_row = 4; while($row=mysql_fetch_array($result)) { $counter++; if(($counter % $cells_per_row) == 1) { echo '<tr>'; } echo '<td>' .$row['stuff']. '</td>'; if(($counter % $cells_per_row) == 0) { echo '</tr>'; } } // just in case we haven't closed the last row // this would happen if our result set isn't divisible by $cells_per_row if(($counter % $cells_per_row) != 0) { echo 'what</tr>'; } echo '</table>'; ?> http://www.captain-movies.com/test/display.php what i am wanting to is split the table so i can insert the images for each table cell Link to comment https://forums.phpfreaks.com/topic/206735-table-issue/ Share on other sites More sharing options...
ram4nd Posted July 5, 2010 Share Posted July 5, 2010 I don't see any relevance between your script and url, can you explain a bit. Link to comment https://forums.phpfreaks.com/topic/206735-table-issue/#findComment-1081417 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.