【发布时间】:2014-04-19 09:25:12
【问题描述】:
这是我页面的脚本代码。 我选择任何日期,然后通过从数据库中选择日期来获取数据。 当我打开我的页面时,我想最初将日期设置为今天。 然后我得到今天和当前时间的数据。 但是如何??? 我举个例子:this is example link. 在这里您可以看到时间戳框以显示当前日期和时间的结果 我想这样做。 但是怎么做?
<link rel="stylesheet" type="text/css" href="tcal.css" />
<script type="text/javascript" src="tcal.js"></script>
<form action="index.php" method="get">
From : <input type="text" name="d1" class="tcal" value="" />
<input type="submit" value="Search">
</form>
<table id="resultTable" data-responsive="table" style="text-align: left; width: 400px;" border="1" cellspacing="0" cellpadding="4">
<thead>
<tr>
<th> Birtday </th>
<th> Name </th>
<th> Gender </th>
</tr>
</thead>
<tbody>
<?php
include('connect.php');
if (isset($_GET["d1"])) { $d1 = $_GET["d1"]; } else { $d1="0000-00-00"; };
$result = $db->prepare("SELECT * FROM birthday WHERE date = :a");
$result->bindParam(':a', $d1);
$result->execute();
for($i=0; $row = $result->fetch(); $i++){
?>
<tr class="record">
<td><?php echo $row['date']; ?></td>
<td><?php echo $row['name']; ?></td>
<td><?php echo $row['gender']; ?></td>
</tr>
<?php
}
?>
</tbody>
</table>
【问题讨论】:
标签: php mysql database timestamp