Hello,
I've got a script to create pages from my database, it works great, but I cannot seem to get the styling in order. Can somebody help me out plz?
On the first page, the images and text that is pulled from the database is nicely ordered in a table with a max of 4 columns. Great. However, on the second page (when you click an image of the outputted results), all of the records are listed on one line..... As the page only accepts 5 or 6 of those on one line due to the width of the page, all of the other records aren't seen.
I've tried multiple things, but now I don't see it anymore. Can anybody see what to change to have a four column table again?
Here's my script:
Thx for helping out!!!PHP Code:<?php
include("../connection.php");
switch($_GET['step']){
default:
$table = "<table style='width:100%;'>\n";
$result = mysql_query("SELECT DISTINCT thumb_sizecat, sizecat, link_size FROM Folders ORDER BY sizecat") or die (mysql_error());
while($row = mysql_fetch_array($result)){
$row['price1'] = round ((($row['price1']+5) *1.85),0);
$base_m=5;
$row['price11'] = $base_m*(ceil(($row['price1'])/$base_m));
$table.="\t\t<td align='center' style='width:25%;'>"
."<a href='?step=items&size=".urlencode($row['sizecat'])."'><img src='{$row['thumb_sizecat']}' alt='{$row['thumb_sizecat']}' />"
."<br />{$row['sizecat']}</a></td>\n";
$colnum++;if($colnum % 4 == 0) $table.="\t</tr>\n\t<tr>\n";
}
$table .= "\t</tr>\n</table>\n";
echo $table;
break;
case "items":
$sizecat=mysql_real_escape_string($_GET['size']);
echo "<table style='width:100%;'>\r\n\t\t<tr>";
$itemsQuery=mysql_query("SELECT * FROM `Folders` WHERE `sizecat`='{$sizecat}';");
while($item=@mysql_fetch_array($itemsQuery)){
$link="?step=color&size=".urlencode($sizecat)."&id=".urlencode($item['id']);
echo "\t\t<td><a href='{$link}'><img src='{$item['thumb_size']}' alt='{$item['thumb_size']}' /><br /><b>Size:</b>{$item['size']}<br /><b>Final size:</b>{$item['finalsize']}<br /></a></td>\r\n";
$colnum++;if($colnum % 4 == 0) $table.="\t</tr>\r\n\t<tr>\n";
}
echo "</tr></table>\r\n";
break;
case "color":
// The rest here has almost the same codings, so I left it out
break;
}
?>



Reply With Quote
I tried hundreds of things, but it either gives a fatal error or the same result is outputted.
Bookmarks