I am not exactly sure but this is probably what you want (crude version). Just set the $serial variable to the id you want to stary with.
<?php
$SESS_DBHOST = "localhost"; /* database server hostname */
$SESS_DBNAME = "temp"; /* database name */
$SESS_DBUSER = "root"; /* database user */
$SESS_DBPASS = ""; /* database password */
$SESS_DBH = mysql_connect($SESS_DBHOST, $SESS_DBUSER,$SESS_DBPASS);
mysql_select_db($SESS_DBNAME,$SESS_DBH);
$serial=2;
$current=1;
$next=1;
$time = mktime (0,0,0,12,31,date("Y"));
$week=date("W", $time); // March 10, 2001, 5:16 pm
$time = mktime (0,0,0,1,1,date("Y"));
$week-=date("W", $time); // March 10, 2001, 5:16 pm
$result = mysql_query("SELECT * FROM users",$SESS_DBH);
$users=mysql_affected_rows();
$result = mysql_query("SELECT * FROM users WHERE id>=$serial ORDER BY id",$SESS_DBH);
while($myrow = mysql_fetch_array($result))
{
$current=$next;
$next++;
echo "($myrow[id]) $myrow[name] ";
while($current<=$week)
{
echo $current." ";
$current+=$users;
}
echo $current-$week." of next year";
echo "<br>";
}
$result = mysql_query("SELECT * FROM users WHERE id<$serial ORDER BY id",$SESS_DBH);
while($myrow = mysql_fetch_array($result))
{
$current=$next;
$next++;
echo "($myrow[id]) $myrow[name] ";
while($current<=$week)
{
echo $current." ";
$current+=$users;
}
echo $current-$week." of next year";
echo "<br>";
}
?>