Re: query question
| From: | Marek Kilimajer | Date: | Thu, 14 Nov 2002 18:09:46 +0000 |
| Subject: | Re: query question | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-124465@lists.php.net to get a copy of this message | ||
Untested, but should work
Steve Buehler wrote:
function getstart_end(){
$result=mysql_query("SELECT * FROM aplayabletimes ORDER BY min");
while(($row=mysql_fetch_object($result))){
if(!$i){
echo $row->min . " - ";
$i=$row->min;
}else{
$tmp = $i + 5 minutes // add 5 minutes to $i, implement it yourself
if($tmp != $row->min) { // there is a gap
echo $i ."<br>\n"; // print previous time as end
echo $row->min . " - "; // print this time as new start
}
$i = $tmp; // keep this new time for next loop
}
}
echo $row->min ."<br>\n"; // print last row
}