Uhm quindi in questo modo:
for ($i = $row; $i < ($row + 10); $i++)
{
echo stripslashes( $fileName [$i]) ;
}
}
else
{
for ($i=0; $i < $rows; $i++)
{
echo stripslashes( $fileName [$i]) ;
}
}
o meglio nel codice completo:
Codice PHP:
<?php
$fileName = file ("guestbook.txt");
$rows = count ($fileName);
if ($rows > 10)
{
if (!isset ($row) )
{
$row = 0;
}
print ("<table><tr><td width=\"50%\">");
if ($row > 0)
{
echo "<div><< <a href=\"readbook.php?row=" . ($row - 10) . "\">Next 10</a></div>";
}
print ("</td><td width=\"50%\">");
if ( ($rows - $row) > 10)
{
echo "<div><a href=\"readbook.php?row=" . ($row + 10) . "\">Previous 10</a> >></div>";
}
print ("</td></tr></table>");
for ($i = $row; $i < ($row + 10); $i++)
{
echo stripslashes($fileName [$i]);
}
}
else
{
for ($i=0; $i < $rows; $i++)
{
echo stripslashes($fileName [$i]);
}
}
?>