gpt4 book ai didi

mysql - 如何标记数据 "historic"并将它们存储在不同的表中

转载 作者:行者123 更新时间:2023-11-29 00:10:00 24 4
gpt4 key购买 nike

因为我的网页上有很多流量,其中有在线聊天,所以我的 mysql 表“消息”过于拥挤。我不想使用 TIMESTAMPDIFF 删除数据,但我想将它们 move 到“历史”表。 10 分钟(600 秒)后是否有办法将它们移至历史表?

<!DOCTYPE
<html lang="en">
<head>
</head>
<body>
<form method="post" action="test.php">
<label for="firstname">First name:</label>
<input type="text" id="firstname" name="firstname" /><br />
<input type="submit" value="Report Abduction" name="submit" />
</form>
</body>
</html>

HTML(测试)文件

<html>
<head>
</head>
<body>

<?php
include("delete.php");
$first_name = $_POST['firstname'];

$dbc = mysqli_connect ('localhost','julianbuchel','****','deletecontent')
or die("Ooops, we couldn't connect to the database...");


$query = "INSERT INTO messages
VALUES ('$first_name')";



if (!mysqli_query($dbc,$query)) {
die('Error: ' . mysqli_error($dbc));
}

mysqli_close($dbc);


echo 'Thanks';
?>

</body>
</html>

PHP(测试)文件

<?php
$server = 'localhost';
$user = 'julianbuchel';
$password = '******';

$link = mysql_connect($server,$user,$password);
$db = mysql_select_db('test');
$ssql = "DELETE FROM messages";
$r = mysql_query($ssql, $use);
?>

最佳答案

好的,谢谢你的想法。我所做的是在我的 mysql 数据库中设置一个 event_schedule bei 输入命令

使用全局 event_schedule = 'ON'

比:创建事件 name_of_event 每 1 小时一类 从表名中删除

我知道这不是我问题的完美答案,但这非常合适!

关于mysql - 如何标记数据 "historic"并将它们存储在不同的表中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25633762/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com