[ balkan7 @ 04.02.2007. 16:40 ] @
pozdrav svima. imam jedan mali problem sa prethodna i sledeca strana, tako da kod mene pokazuje samo brojeve za te starne, kako jos mogu dodati sa tekstom za sledecu i prethodnija stranu ? kod je: Code: <?php 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>Produkt</td> <td width=100 align=center>Akcija</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"; ?> |