hello,
i have following php-mysql image list script, which populate images in columns and rows of html tables, but i want to change the html columns and rows strctures into xhtml and css, i don't know how to do,
<?php
$albumId = $_GET['album'];
$query = "SELECT im_id, im_title, im_thumbnail
FROM tbl_image
WHERE im_album_id = $albumId
ORDER BY im_title";
$result = mysql_query($query) or die('Error, list image failed. ' . mysql_error());
if (mysql_num_rows($result) == 0) {
echo "No image in this album yet";
} else {
echo '<table width="700" border="0" cellspacing="1" cellpadding="2" align="center">';
// the image is listed in a table
// here we specify how many columns
// we want to show on each row
$colsPerRow = 4;
// width of each column in percent
$colWidth = (int)(100/$colsPerRow);
$i = 0;
while ($row = mysql_fetch_assoc($result)) {
if ($i % $colsPerRow == 0) {
// start a new row
echo '<tr>';
}
echo '<td width="' . $colWidth . '%">' .
'<a href="?page=image-detail&album=' . $albumId . '&image=' . $row['im_id'] . '">' .
'<img src="viewImage.php?type=glthumbnail&name=' . $row['im_thumbnail'] . '" border="0">' .
'<br>' . $row['im_title'] . '</a></td>';
if ($i % $colsPerRow == $colsPerRow - 1) {
// start a new row
echo '</tr>';
}
$i += 1;
}
// print blank columns
if ($i % $colsPerRow != 0) {
while ($i++ % $colsPerRow != 0) {
echo '<td width="' . $colWidth . '%"> </td>';
}
echo '</tr>';
}
echo '</table>';
}
?>
please help in this regard....