althalus
08-27-2004, 09:37 AM
i have a guestbook script, where part of it looks like:
<?php
$fileName = file ("log.txt");
$rows = count ($fileName);
if ($rows > 10)
{
if (!isset ($row) )
{ $row = 0; }
if ($row > 0)
{ echo "[<a href=\"index.php?p=main&row=" . ($row - 10) . "\"> +10 </a>]<br>"; }
if ( ($rows - $row) > 10)
{ echo "[<a href=\"index.php?p=main&row=" . ($row + 10) . "\"> -10 </a>]<br>"; }
for ($i = $row; $i < ($row + 10); $i++)
{ echo $fileName [$i]; }
}
else
{ for ($i=0; $i < $rows; $i++)
{ echo $fileName [$i]; }
}
?>
it prints out links to a "new page" if there's more than 10 entries on the page. the link ends up on top of the messages, but i'd like to have the links on the bottom. tried fiddling aroudn with it some, but i'm not that good with php so it told me the ELSE was in the wrong spot. any help appreciated! :)
<?php
$fileName = file ("log.txt");
$rows = count ($fileName);
if ($rows > 10)
{
if (!isset ($row) )
{ $row = 0; }
if ($row > 0)
{ echo "[<a href=\"index.php?p=main&row=" . ($row - 10) . "\"> +10 </a>]<br>"; }
if ( ($rows - $row) > 10)
{ echo "[<a href=\"index.php?p=main&row=" . ($row + 10) . "\"> -10 </a>]<br>"; }
for ($i = $row; $i < ($row + 10); $i++)
{ echo $fileName [$i]; }
}
else
{ for ($i=0; $i < $rows; $i++)
{ echo $fileName [$i]; }
}
?>
it prints out links to a "new page" if there's more than 10 entries on the page. the link ends up on top of the messages, but i'd like to have the links on the bottom. tried fiddling aroudn with it some, but i'm not that good with php so it told me the ELSE was in the wrong spot. any help appreciated! :)