<?
session_start();
$q = 'select * from yourtable';
if (isset($_SESSION['prev_id'])) $q .= " where id > '" . $_SESSION['prev_id'] . "'"; // are we getting the next record?
$q .= ' limit 1'; // just get 1 record
$rs = @mysql_query($q) or die('Problem with query: ' . $q . '<br>' . mysql_error());
if (@mysql_num_rows() == 1) {
$_SESSION['prev_id'] = $rw['id']; // store the current record's id
$tmp = array();
$rw = @mysql_fetch_assoc($rs);
$tmp[] = '<form action="" method="post">';
foreach($rw as $k=>$v)
if ($k != 'id') echo $k . ': ' . $v . '<br>';
$tmp[] = '<input type="submit" name="submit" value="Next">';
$tmp[] = '</form>';
echo implode("\n",$tmp)."\n"; // just my way of displaying HTML with a "\n" at the end of each line.
}
else {
//
// no more records to display, do somethng
//
}