you would have to do a count on the db to see if total records<100..note below code is not tested and would need more to retreive data from whereever you are getting it
//get all the record ids from the table - used (a) to count the num
//of records and (b)to find the smallest id number available for
//insert/uptdate - use date function to pull earliest date when
//overwriting the old data
$sql="select id,datestamp from table order by datestamp";
$result=mysql_query($sql); //leave the link stuff up to you
if (!$result){
echo "there was an error. try again";
}else{
//see if it is to be insert or update
$num=mysql_num_rows($result);
if ($num<100){
//want to insert data
$sql_insert = "insert into blablabla";
}esle{
//want to update the earliest row
for ($count = 1; $row = mysql_fetch_row ($result); ++$count){
//assign earliest item to a variable
$id=$row['id'];
$sql_update="update tablename set fieldx='valuex', fieldy='valuey' where ID=$id";
$result_update=mysql_query($sql); //don't forget link items
//check if update was successful
if($result){
echo "update sucessful!";
}
//kill the loop and exit the procedures
if ($count=2){
break;
}
}//end for loop
}//end if loop for insert/update
} //end main if/then loop
?>