Jump to content

table issue


michaeljp64

Recommended Posts

<?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

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.