Display in table + pagination
Posted: Sun Mar 26, 2006 8:35 am
feyd | Please use
You may have guessed it by now. This is a script designed to be used in a PhpBB forum. As you can see, a bug in the script exists when the total number of items exceed 60 items (NOTE: Count starts from 0, not 1. Hence when $er=59, there are 60 items). The table will shrink, while the last row increases in columns for every extra item.
How can I fix this?
I am also thinking of paging it such that there is only 60 items available per-page. How can i do this?
feyd | Please use
Code: Select all
andCode: Select all
tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
I'm working on a project that involves displaying images of items on a table with four columns.
Right now, it's in a four column table and i can only manage to insert the rowbreak "</tr><tr>" tag like so:
(Note: this is only a small section of the entire script)Code: Select all
for ($er = 0; $er < mysql_num_rows($result); $er++)
{
$row = mysql_fetch_array($result);
$sql2 = "SELECT `name`, `desc` FROM `*_*_*_items` WHERE `item_id` =". $row['item_id'];
if ( !($result2 = $db->sql_query($sql2)) )
{
message_die(GENERAL_MESSAGE, 'Fatal Error Getting Item List');
}
$row2 = mysql_fetch_array($result2);
if ($er == 3) {
$trinsert = '</tr><tr>';
} else if ($er == 7) {
$trinsert = '</tr><tr>';
} else if ($er == 11) {
$trinsert = '</tr><tr>';
} else if ($er == 15) {
$trinsert = '</tr><tr>';
} else if ($er == 19) {
$trinsert = '</tr><tr>';
} else if ($er == 23) {
$trinsert = '</tr><tr>';
} else if ($er == 27) {
$trinsert = '</tr><tr>';
} else if ($er == 31) {
$trinsert = '</tr><tr>';
} else if ($er == 35) {
$trinsert = '</tr><tr>';
} else if ($er == 39) {
$trinsert = '</tr><tr>';
} else if ($er == 43) {
$trinsert = '</tr><tr>';
} else if ($er == 47) {
$trinsert = '</tr><tr>';
} else if ($er == 51) {
$trinsert = '</tr><tr>';
} else if ($er == 55) {
$trinsert = '</tr><tr>';
} else {
$trinsert = '';
}
$items = '<td align=center width="25%"><img src="shop/images/' . $row2['name'] . '.png" width=50 height=50 alt="' . $row2['desc'] . '" border=1></a><br><span class="gensmall">' . $row2['name'] . '</span></td>' . $trinsert;
$template->assign_block_vars('item_listrow', array(
'ITEMROW' => $items)
);
}How can I fix this?
I am also thinking of paging it such that there is only 60 items available per-page. How can i do this?
feyd | Please use
Code: Select all
andCode: Select all
tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]