| | |
coverting html tables into xhtml and css
Please support our HTML and CSS advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: May 2008
Posts: 74
Reputation:
Solved Threads: 0
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,
please help in this regard....
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>';
}
?> First of all, table is NOT deprecated in xhtml. There is no reason to avoid using a table where a table is needed. This sounds like tabular data.
What is discouraged is the use of tables to simulate margins and padding. This was done before styles were invented. Using tables to delineate sections of a document is also discouraged.
What is discouraged is the use of tables to simulate margins and padding. This was done before styles were invented. Using tables to delineate sections of a document is also discouraged.
Daylight-saving time uses more gasoline
![]() |
Other Threads in the HTML and CSS Forum
- Previous Thread: align table
- Next Thread: Liquid CSS width off in IE 5.x
| Thread Tools | Search this Thread |
appointments asp background backgroundcolor beta browser bug calendar cart cgi code codeinjection corporateidentity css design development displayimageinsteadofflash dreamweaver emailmarketing epilepsy explorer firefox flash form format google griefers hackers hitcounter hover html ide ie7 ie8 iframe image images internet internetexplorer intranet iphone javascript jpeg layout macbook maps marketshare microsoft mozilla multimedia navigationbars news offshoreoutsourcingcompany opacity opera optimization pnginie6 positioning problem scroll seo shopping studio swf swf. textcolor timecolor titletags url urlseparatedwords visual visualization web webdevelopment webform website windows7






