我有一个脚本,在我的MySQL数据库中添加内容与日期/时间戳。无法为我更改输入日期/时间。在查询SQL更改日期时间
我想日期时间改变时,我查询了我的MySQL数据库。
cell in my db:2016-08-13 17:34:29 它需要是:2016-08-13 19:34:29(so +02:00小时显示导致查询) 我不能更新时间导致其他应用程序依赖于数据库中的数据。
然后,我想只查询在NOW和+ 15分钟之间添加了额外时间的项目。
不知道它是否重要,但即时运行MariaDB SQL。
在此先感谢!
现在网站编码:
<?php
//make connection
mysql_connect('localhost','root','');
//select db
mysql_select_db('database');
$sql="SELECT *
FROM table
WHERE `id` = 147
ORDER BY `disappear_time` DESC";
$records=mysql_query($sql);
?>
<html>
<body>
<table width="1000" border="1" cellpadding="1" cellspacing="1">
<tr>
<th>encounter_id</th>
<th>disappear_time</th>
</tr>
<?php
while($item=mysql_fetch_assoc($records)){
echo "<tr>";
echo "<td>".$item['encounter_id']."</td>";
echo "<td>".$item['disappear_time']."</td>";
echo "</tr>";
}
?>
</body>
</html>
---已经尝试过: SELECT * FROM表WHERE 时间> = NOW()和时间< = NOW()+间隔15 MINUTE
错误:SELECT不起作用:警告:mysql_fetch_assoc()期望参数1是资源,布尔值在.....
我很困惑。样本数据和期望的结果可能有助于澄清你想要做什么。什么是“细胞”? –
我想在+02:00小时的结果中编辑时间,然后在NOW和+15分钟之间显示结果 – shadi1989
SELECT column + INTERVAL 2 HOUR x FROM表 – Strawberry