<?php

include 'db.php';

$data = mysql_query("SELECT * FROM `rek` WHERE `ok` = '1' ORDER BY RAND() LIMIT 50");

while ($row = mysql_fetch_assoc($data)){

$time = time();

$srok=$time-$row['data'];

if ($srok > $row['days']*86400 ) {

mysql_query("UPDATE `rek` SET `srok` = '0'  WHERE `id` = '".$row['id']."'");



$x++;

}

}



echo $x;

?>

