Get number of rows with
SELECT COUNT(*) FROM menuitem
And display links only when they should be displayed
$prev = $start - 4;
if ($prev >= 0) {
echo '<td><a href="?start=' . $prev . '">Previous Items</a></td>';
}
$next = $start + 4;
if ($next < $count) {
echo '<td><a href="?start=' . $next . '">Next Items</a></td>';
}