alright
<?php
define('ROOT_PATH', './');
$fast = 1;
include(ROOT_PATH.'global.php');
include(ROOT_PATH.'includes/sessions.php');
$max_columns = 10; //maximum columns
$max_rows = 10; //maximum rows
$max = $max_columns * $max_rows; //total of database entries that could fit
$sql = "SELECT *
FROM ".IMAGES_TABLE."
LIMIT ".$max;
if ($result = $site_db->query($sql))
{
$x = 0; //initialize current count of columns
$y = 0; //initialize current count of rows
$text = "<table>\n<tr>\n<td>\n";
while ($row = $site_db->fetch_array($result)) //fetching data from database
{
$text .= $row['image_name']; //the data what you want to print
$text .= "\n<br />\n"; //next item should go to the next row
if (++$y == $max_rows) //increase current count of rows and check if its maxed out
{
$y = 0; //reset number of rows
$text .= "</td>\n<td>\n"; //closing current column and opening new column
if (++$x == $max_columns) //increase current count of columns and check if its maxed out
{
break; //ok, max number of columns reached, no more room for more data
}
}
}
$text .= "</td>\n</tr>\n</table>";
}
echo $text;
?>