我试图创建一个页面,用户可以在两个日期和时间之间搜索所有mySQL查询的MySQL general_log,但我不知道如何格式化用户输入数据,所以它可以在表格中阅读。
这是我(非常)粗暴地刺伤它,我有点迷失; MYSQL查询;
$result = mysqli_query($con,"SELECT * FROM general_log WHERE event_time between UNIX_TIMESTAMP('$fromDate') AND UNIX_TIMESTAMP('$toDate'");
表;
<h1>Query Error Log</h1>
<h2>Insert Date/Time as format YYYY-MM-DD HH:MM:SS</h2>
<h2>From Date:Time</h2><input type="number" id="fromDate" name="fromDate" value="" /> <p></p>
<h2>To Date:Time</h2><input type="number" id="toDate" name="toDate" value="" /> <p></p>
<p></p><input type="submit">
感谢您的帮助
答案 0 :(得分:0)
试试这个
$result = mysqli_query($con,"SELECT * FROM general_log WHERE (event_time BETWEEN UNIX_TIMESTAMP('$fromDate') AND UNIX_TIMESTAMP('$toDate'))";