【发布时间】:2014-07-30 04:13:37
【问题描述】:
我正在使用 html 和 php 的组合为我自己的小商店做销售记录。
我想有时间选择输入(选择时类似于 2014 年 3 月、2014 年 4 月)
这是我的 index.php
<?php
$con=mysqli_connect("192.168.1.248","a","a","services");
if (mysqli_connect_errno()) {
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$result = mysqli_query($con,"SELECT * FROM pcsales");
echo "<h3><marquee><b>====PC Sales====</b></marquee></h3>";
echo "<button type='button' name='add' onClick='add()'>Add</button>";
echo "<script type='text/javascript'>
function add()
{
window.location='./edit';
}
</script>";
echo "<button type='button' name='edit' onClick='edit()'>Edit</button>";
echo "<script type='text/javascript'>
function edit()
{
window.location='./edit/edit.html';
}
</script>";
echo "<table border='1'>
<tr>
<th>ID</th>
<th>Type</th>
<th>If Others</th>
<th>Brand</th>
<th>Description</th>
<th>Date Sold</th>
<th>Serial No.</th>
</tr>";
while($row = mysqli_fetch_array($result)) {
echo "<tr>";
echo "<td><p style='font-size:12px'>" . $row['ID'] . "</p></td>";
echo "<td>" . $row['Type'] . "</td>";
echo "<td>" . $row['Types'] . "</td>";
echo "<td>" . $row['Brand'] . "</td>";
echo "<td><p style='font-size:12px'>" . $row['Description'] . "</p></td>";
echo "<td><p style='font-size:12px'>" . $row['Selldate'] . "</p></td>";
echo "<td><p style='font-size:12px'>" . $row['Serial'] . "</p></td>";
echo "</tr>";
}
echo "</table>";
echo "<h3><marquee direction=right><b>====PC Sales====</b></marquee></h3>";
mysqli_close($con);
?>
我在 mysql 中使用 TIMESTAMP。 这是输出
ID 类型 如果是其他 品牌描述 销售日期 序列号 1 笔记本 Acer E1 添加 2GB DDR3 1600 RAM 2014-06-25 11:57:58 123456789 2 其他 AIO Asus N/A 2014-07-25 12:52:12 987654321 3 桌面 Trendsonic 完整规格已列出。 2014-07-30 09:55:10 不适用当我在文本框上放置一个范围时(如果可以选择更方便) 示例:
2014 年 7 月
那么输出应该是
ID 类型 如果是其他 品牌描述 销售日期 序列号 2 其他 AIO Asus N/A 2014-07-25 12:52:12 987654321 3 桌面 Trendsonic 完整规格已列出。 2014-07-30 09:55:10 不适用如果只是
2014被插入,那么它将输出 2014 年的所有内容 有可能这样做吗?
注意:我不关心漏洞利用,因为它在内部使用。
【问题讨论】:
-
"注意:我不关心漏洞利用,因为它在内部使用。"因为没有一家公司有过心怀不满的员工。
-
好吧,我没有真正的雇员,因为所有的“工人”都是我的家人 :D