1
<?php

$user = "root";
$password = "";
$database = "code";
mysql_connect("localhost", $user, $password);
mysql_select_db($database) or die("Unable to select database");

// check if a running process
$query = mysql_query("select * from cats where update_status = 1");
$connections = mysql_num_rows($query);
if ($connections >= 1) {
    die("overload");
}


mysql_query("update cats set update_status = 1 where id = 4");

// working....
sleep(50);

mysql_query("update cats set update_status = 0 where id = 4");

mysql_close();

问题是当我调用这个页面时,
在睡眠功能时间内我打开了同一页面的新标签,页面继续执行睡眠功能。

它应该给“过载”?
注意:如果我将此代码复制到新页面(例如 test.php)并在睡眠时间内加载它,它可以工作

4

0 回答 0