...

View Full Version : Prev - Next Help



balkan
02-03-2007, 11:55 PM
hi
i need help to add button or picture Prev and Next, in my script i just have show prev or next whit numbers, someone help me to add button or picture for prev or next ?


<?
if(empty($_GET[Start]))
{
$Start = '0';
}
else
{
$Start = $_GET[Start];
}

$ByPage = '10';

//show the catalog content
$q1 = "select ItemID, ItemName from bsoft_catalog order by ItemName limit $Start, $ByPage";
$r1 = mysql_query($q1) or die(mysql_error());

if(mysql_num_rows($r1) > '0')
{
?>
<table align=center width=400 cellspacing=0>
<tr class=TableHead>
<td width=300>Product</td>
<td width=100 align=center>Action</td>
</tr>

<?

$col = "white";

while($a1 = mysql_fetch_array($r1))
{
if($col == "white")
{
$col = "dddddd";
}
else
{
$col = "white";
}

echo "<tr bgcolor=\"$col\">\n\t<td><a href=\"view_item.php?ItemID=$a1[ItemID]\" class=Nav>$a1[ItemName]</a></td>\n<td align=center><a class=GreenLink href=\"edit_item.php?ItemID=$a1[ItemID]\">izmeni</a> | <a href=\"delete_item.php?ItemID=$a1[ItemID]\" class=RedLink OnClick=\"return cdel('$a1[ItemName]');\">brisi</a></td>\n</tr>\n\n";
}

echo "</table>";

$qnav = "select count(*) from bsoft_catalog";
$rnav = mysql_query($qnav) or die(mysql_error());
$anav = mysql_fetch_array($rnav);
$rows = $anav[0];

if($rows > $ByPage)
{
$NextPrev = "<br><table align=center width=400><tr>";
$NextPrev .= "<td align=center class=Nav> | ";

$pages = ceil($rows/$ByPage);

for($i = 0; $i <= ($pages); $i++)
{
$PageStart = $ByPage*$i;

$i2 = $i + 1;

if($PageStart == $Start)
{
$links[] = " <span class=RedLink>$i2</span>\n\t ";
}
elseif($PageStart < $rows)
{
$links[] = " <a class=Nav href=\"catalog.php?Start=$PageStart\">$i2</a>\n\t ";
}
}

$links2 = implode(" | ", $links);

$NextPrev .= $links2;

$NextPrev .= "| </td>";

$NextPrev .= "</tr></table><br>\n";

echo $NextPrev;
}

}

include "footer.php";

?>

rizwan
02-04-2007, 03:05 PM
I would recomend you the javascript previous next option, it better then php and works perfectly fine... let me know if you need that

balkan
02-04-2007, 03:21 PM
if you know php code for prev and next please write here, in my code just show numbers of page, i need now add TEXT prev - next and stay numbers of page ...



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum