我该如何重写这段代码:
$res = mysql_query("SELECT * FROM user");
$timech = mysql_result($res, 0, 0);
$timecheck = time() - $timech;
$time = time();
if($timecheck > 60) {
session_start();
$offline="Offline";
$session = "";
$user_time_check = "";
$user_time_check = "";
$ipaddress = "";
mysql_connect(db_server, db_user, db_pass);
mysql_db_query(db_name,"UPDATE user SET server_time_check = '$server_time_check', ip_address = '$ipaddress', last_sign_in_stamp = '".time()."', online = '$offline', session = '$session'") or die (mysql_error());
mysql_close();
}
php 上的 time() 似乎弄乱了我的代码,没有显示也使用 $res 的分页。当我使用 $time 时,该函数不会更新我的数据库。有人知道问题是什么吗?
有人知道我如何重写它吗?