Germaris wrote:By the way, how would you write this "exploring" PHP?
Well... as I said, this solution loops through the entire table, so I'm sure it's the least efficient of solutions, but here 'goes:
$query = 'SELECT `id_field` FROM `table` ORDER BY `id_field` ASC';
$exec = mysql_query($query);
for($i=1,$last=mysql_result($exec, 0),$missing=array(); $i<mysql_num_rows($exec); $i++) {
if(($num = mysql_result($exec, $i)) && $num != $last)
$missing[] = $num;
$last = $num
}
Then, $missing would be an array of missing numbers. If it's an empty array, no numbers were missing obviously.
EDIT: Code is untested - written off the top of my head, so who knows if it works properly.