Php如何选择存储在数据库中的时间组合框

I have the time combobox which is showing the time properly and storing in database.

How to select the time in that list which is stored in the database.

In the database the stored time is 02:30 and in this all times are there i want to select the 02:30 from this list this time list is automatically populated.

Any help will be appreciated.

My Code

<select name="open" class="form-control" style="width: 112px;">
<?php
    $start=strtotime('00:00');
    $end=strtotime('23:59');
    for ($halfhour=$start;$halfhour<=$end;$halfhour=$halfhour+30*60) {
printf('<option value="%s">%s</option>',date('H:i',$halfhour),date('g:i a',$halfhour));
    }
?>
</select>

Well i have found the solution.

$user   =   mysql_query("
select * from timing where sr_id = '".$_GET['id']."'
");
$usert  =   mysql_fetch_assoc($user);
$open   =   $usert['open'];

$start=strtotime('00:00');
$end=strtotime('23:59');
for ($halfhour=$start;$halfhour<=$end;$halfhour=$halfhour+30*60) {

$ttt=date('H:i',$halfhour);

if ($open == $ttt){
printf('<option selected value="%s">%s</option>',date('H:i',$halfhour),date('g:i a',$halfhour));
}else{
printf('<option value="%s">%s</option>',date('H:i',$halfhour),date('g:i a',$halfhour));
}
}

It will select the time stored in database from this timing list by using $open and making variable of date('H:i',$halfhour) from that time code $ttt=date('H:i',$halfhour); of inside if condition if ($open == $ttt){ in that time code.

Inspired by @Fred-ii-