Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/69.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何显示来自数据库的时间提醒_Php_Html_Mysql - Fatal编程技术网

Php 如何显示来自数据库的时间提醒

Php 如何显示来自数据库的时间提醒,php,html,mysql,Php,Html,Mysql,我有一个显示数据库数据的表。例如,类似这样的内容: <table> <tr> <th>Title</th> <th>Date</th> <th>Start Time</th> <th>End Time</th> </tr> <tr> <td>Fr

我有一个显示数据库数据的表。例如,类似这样的内容:

<table>                       
  <tr>
    <th>Title</th>
    <th>Date</th>
    <th>Start Time</th>
    <th>End Time</th>
  </tr>
  <tr>
    <td>French</td>
    <td>21 December 1992</td>
    <td>23:00</td>
    <td>05:00</td> 
  </tr>
------


开始时间: 结束时间:
尝试下面的代码。您可以使用“$sql->start\u time”代替“$start\u time”,使用“$sql->date”代替“$start\u date”。检查一下你的行李

上述代码给出的输出为:

剩余2小时/22分钟/30秒


您可以根据需要进行编辑。

谢谢,这很有帮助。虽然,我真的不知道为什么我得到这么多的反对票。我不明白。谢谢你的帮助。
$sql = DB::getInstance()->get('sessions', array('MONTH(date)','=' ,$userSelection));
//mysql_db_query('nio', "SELECT DATE");
echo "<table class='table table-hover'style='color: orange' > "
    ."<thead>
        <tr>
          <th>Title</th>
          <th>Date</th>
          <th>Start Time</th>
          <th>End Time</th>
        </tr> 
      </thead>
    <tbody>";

if(!$sql->count()){
  echo 'No data';
}else {
  foreach ($sql->results() as $sql){ 
    echo "<tr style='background-color: black'>";
    echo "<td><a href = session-options.php>" .  $sql->title . "</a></td>";
    echo "<td>" . $sql->date . "</td>";
    echo "<td>" . $sql->start_time . "</td>";
    echo "<td>" . $sql->end_time . "</td>";
    echo "</tr>";
  ?>
                <?php }}echo"   </tbody>";
 echo" </table>";
}     

?>
try {
  $user->createSession(array(
           'title' => Input::get('title'),
           'date' => Input::get('date'),
           'start_time' => Input::get('timepicker1'),
           'end_time' => Input::get('timepicker2'),
           'passcode' => (Input::get('passcode')),
           'username' => $user->data()->username,
           'module' => $module
));
<div class="input-group date" data-date-format="yyyy-mm-dd">
  <input type="text" class="form-control" name="date" id="date" placeholder="Choose Date:">
  <span class="input-group-addon">
    <i class="glyphicon glyphicon-th"></i>
  </span>
</div> <br>

<div class="row">
  <div class="col-lg-5"><div class="input-group">
    <div class="input-append bootstrap-timepicker top-margin"> Start Time:
      <input id="timepicker1" type="text"  name="timepicker1">
      <span class="add-on"><i class="glyphicon glyphicon-time"></i></span>
    </div>
  </div>
</div>

<div class="col-lg-5">
  <div class="input-group">
    <div class="input-append bootstrap-timepicker top-margin"> End Time:
      <input id="timepicker2" type="text"  name="timepicker2">
      <span class="add-on">
        <i class="glyphicon glyphicon-time"></i></span>
   </div>
 </div>
date_default_timezone_set("Asia/Kolkata");

$start_date = '2015-03-02';
$start_time = '04:15:58';
$current_datetime = date('Y-m-d H:i:s', time());


$start_datetime = new DateTime($start_date.' '.$start_time);
$end_datetime = new DateTime($current_datetime);

$since_start = $start_datetime->diff($end_datetime);

echo ($since_start->days * 24)+$since_start->h.' hours / ';
echo $since_start->i.' minutes / ';
echo $since_start->s.' seconds remaining';