Código PHP:
<?php
ob_start();
$numero = rand(1,200);
$consulta = "SELECT * FROM `tabla` WHERE `id` = '$numero'";
$result = mysql_query($sql,$conexion);
$i = mysql_fetch_array($result);
?>
<html>
<head>
</head>
<body>
<table border="0">
<tr>
<td><? echo($i['titulo']); ?></td>
</tr>
</body>
<?php
$contenido=ob_get_contents();
ob_end_flush();
$archivo = "12-07-2005.html";
$crear = fopen($archivo,"w");
$grabar = fwrite($crear,$contenido);
fclose($crear);
?>
Una solucion mas facil y efectiva sin modificar codigo existente solo adicion de nuevo