2
我在PHP.Currently而尋找根據最新的工作對股票項目是根據其是好。不過那些未利用日期檢索日期顯示數據(如果我輸入25.12.2015,結果它應該顯示之前的日期數據,如23.12.2015在這種情況下)。
我的html代碼是:
<form action="dateview.php" method="post">
<table width="60%" border="2" bordercolor="green">
<tr>
<td>DATE</td>
<td>
<input type="date" name="date">
</td>
<td colspan="2">
<center><input type="submit" value="search"/></center>
</td>
</table>
</form>
我的php代碼是:
<?php
if($qw="select * from details where date='$date'"){
$qq = mysqli_query($con,$qw);
while($r=mysqli_fetch_array($qq,MYSQLI_ASSOC))
{
?>
<tr>
<td><?php echo $r['itemname']; ?></td>
<td><?php echo $r['deposit']; ?></td><td><?php echo $r['withdraw']; ?></td>
<td><?php echo $r['total']; ?></td>
<td><?php echo $r['approvedby']; ?></td>
<td><?php echo $r['receivedby']; ?></td>
<td><?php echo $r['givenby']; ?></td>
<td><?php echo $r['receivedto']; ?></td>
</tr>
<?php } ?>
'25.12.2015'或'23.12.2015'不是一個有效的格式,無論是數據保存爲'unix時間戳'或'datetime'。之後,數據操作查詢可能會發生。現在您需要[格式](https://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_date-format)提前預約。 – Xorifelse
將條件改爲'where date <='$ date'「',這會給你以前的日期數據包括你通過的日期的數據 –
謝謝Code-Monk.Its工作。 – saurabh