"J.O. Aho" wrote in message
> for($i=1000;$i<=30000;$i++) {
> $query="SELECT count(*) FROM table WHERE column='UR{$i}'";
> $res=mysqli->query($query);
> if(!$res->num_rows) {
> echo "Missing number is UR{$i}\n";
> }
> }
aho, i'm not going to say that's a crazy way to do it...but, just look at
the resources you're wasting! you really want to run a query for *every*
iteration? even this is more attractive...but butt-ugly:
$sql = array();
for ($i = 1000; $i <= 3000; $i++)
{
$sql[] = "
SELECT 'UR" . $i . " Id ,
COUNT(*) Missing
FROM table
WHERE column = 'UR" . $i . "
";
}
$sql = "
SELECT *
FROM
(
" . implode(' UNION', $sql) . "
)
WHERE Missing = 0
";
$query = mysqli->query($sql);
echo '<pre>' . print_r($query, true) . '</pre>';
>> Stay informed about: Missing Nubers