For a crude solution, given the timings range (1 minute to 1 day), you could get away with a simple loop.
If your loop runs reliably within a few seconds, you can check the php time (now()) (rounded to the nearest minute - by diving by 60)) (php time is given in seconds as an integer). You can then test the mod() of this value dividing by the relevant interval represented as minutes.
If the result is 0, that event can be triggered.
If the number of sensors isn't to large, it might help to read them in once (before your loop) and stored them in an associative array keyed on the interval.
$sensors=array();
... while(fetch_row ..){
$interval=$row['polling_time'];
$sensors["$interval"][]=$row;
}
...
$prevtime=intval(round(floatval(now()/60),0);
while (true)
{
$thistime=intval(round(floatval(now()/60),0);
if ($thistime == $prevtime)
{
sleep(1);
continue;
}
$prevtime=$thistime;
foreach ($sensors as $interval=>$intsensors)
{
if (($thistime%intval($interval)) == 0)
{ // this interval has been matched to the current time - so get the sensors
foreach ($intsensors as $this_sensor)
{
extract($this_sensor);
// do what you like with this sensor's details.
}
}
}
sleep(10) // or however many seconds you need to make your loop work smoothly
}
... etc
Like I said - crude but may work OK - given your (in computing terms) reasonably large timescales. Cheers