> $max_row = 5;
> if ($op == "next") {
> $low = $low + $max_row;
> $high = $low + $max_row;
Either this...
> $result = mysql_query("SELECT * FROM TABLENAME where Post='yes' LIMIT
$low, $high");
> while($row = mysql_fetch_row($result)) {
> echo "<b>$row[1] writes</b>:<br>\n";
> echo "    <i>$row[2]</i><br>\n";
> echo "<b>AskLee writes</b>:<br>\n";
> echo "    <i>$row[3]</i><br>\n";
> echo "<hr>\n";
> }
> }
> elseif ($op == "prev") {
> $low = $low - $max_row;
> $high = $high - $max_row;
Or this is wrong. :-)
I think $high should *always* be $low + $max_row;
> $result = mysql_query("SELECT * FROM TABLENAME where Post='yes'
LIMIT $low, $high");
> while($row = mysql_fetch_row($result)) {
> echo "<b>$row[1] writes</b>:<br>\n";
> echo "    <i>$row[2]</i><br>\n";
> echo "<b>AskLee writes</b>:<br>\n";
> echo "    <i>$row[3]</i><br>\n";
> echo "<hr>\n";
> }
> } else {
Also, you really should compute your low/high, and *THEN* do one query, and
one output.
As it stands now, if you change your query/output, you have to change it in
three places at once.
> $low = 0;
> $high = $low + $max_row;
> $result = mysql_query("SELECT * FROM TABLENAME where Post='yes' LIMIT
$low, $high");
> while($row = mysql_fetch_row($result)) {
> echo "<b>$row[1] writes</b>:<br>\n";
> echo "    <i>$row[2]</i><br>\n";
> echo "<b>AskLee writes</b>:<br>\n";
> echo "    <i>$row[3]</i><br>\n";
> echo "<hr>\n";
> }
> }
> $result = mysql_query("SELECT * FROM mpn_asklee where Post='yes'");
> $num_rows = mysql_num_rows($result);
> if ($num_rows > $max_row) {
> echo "<table width=\"100%\" cellspacing=\"0\" border=\"0\"
cellpadding=\"0\">\n";
> echo "<tr><td align =\"left\">\n";
> if ($low > $max_row) {
> echo "<a href=\"$PHP_SELF?op=prev&low=$low&high=$high\">Previous</a>";
> }
> echo "</td><td align =\"right\">\n";
> if ($num_rows > $high) {
> echo "<a href=\"$PHP_SELF?op=next&low=$low&high=$high\">Next</a>";
> echo "</td></tr></table>\n"
> }
> }
> ?>
Oh yeah: Start indenting between { and } The hair you save may be your
own.
--
WARNING [EMAIL PROTECTED] address is an endangered species -- Use
[EMAIL PROTECTED]
Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]