Well, for one thing you never define either $story_type or $totalrows in the section of code that you've given us here, nor $id although I suppose if global variables are set that might work. Secondly your code is hard to read and it's not the way that I personally would write it.
$limit = 5;
$Query1 = "SELECT * FROM mydata ORDER BY id DESC";
if(empty($page))
$page = 1;
$limitvalue = $page * $limit - ($limit);
$result = mysql_query($Query);
if(mysql_num_rows($result) == 0) {
print ("\n");
}
$totalrows = mysql_num_rows($Query1);
$Query = "SELECT * FROM mydata ORDER BY id DESC LIMIT $limitvalue, $limit";
$Result = mysql_db_query ($dbname, $Query, $connection);
while ($Row = mysql_fetch_array($Result)) {
echo "<table width=64 border=0 cellspacing=2 cellpadding=0>
<tr>
<td><font face=verdana size=-2>".$Row[quote];."</td>
</tr>
<tr>
<td><font face=verdana size=-2>".$Row[name];."</td>
</tr>
<tr>
<td><font face=verdana size=-2>".$Row[location];."</td>
</tr>
</table>";
}
echo " - ";
if($page != 1){
$pageprev = $page - 1;
echo("<B><font face=verdana size=-2><a href=\"story_display.php?author_id=$id&story_type=$story_type\">PREV</a>_");
} else {
echo("<B><font face=verdana size=-2>PREV_</font>");
}
$numofpages = $totalrows / $limit;
for($i = 1; $i <= $numofpages; $i++){
if($i == $page) {
echo("<font face=verdana size=-2>".$i."_");
} else {
echo("<font face=verdana size=-2><a href=\"story_display.php?author_id=$id&story_type=$story_type&page=$i\">$i</a>_");
}
if(($totalrows % $limit) != 0){
if($i == $page) {
echo($i."_");
} else {
echo("<font face=verdana size=-2><a href=\"story_display.php?author_id=$id&story_type=$story_type&page=$i\">$i</a>_");
}
} // Ends the if statement
if(($totalrows - ($limit * $page)) > 0){
/* This statement checks to see if there are more rows remaining, meaning there are pages in front of the current one. */
$pagenext = $page + 1;
// Not very Fancy way of adding 1 to page
echo("<font face=verdana size=-2><a href=\"story_display.php?author_id=$id&&story_type=$story_type&page=$pagenext\">NEXT</a>");
/* Since there are pages remaining, this outputs NEXT in link form. */
} else {
echo("<font face=verdana size=-2>_ NEXT ");
}
mysql_free_result($result);
/* This line is not required, since MySQL will free the result after all scripts have finished executing; however, it's a nice little backup. */
}
// The next line tells the server to stop parsing PHP
Note: I haven't fixed either $id or $story_type here as I have no idea where you're getting them from. At the least they should be removed from the "s in the echo.
Denise