用户发送 sql 查询,有时(通常是服务器繁忙)重复的 sql 行。我想阻止它。例如,如果用户同时发送相同的查询,则 sql 只接受一个查询。我不想总是删除它。我可以在 phpmyadmin 上做吗?
如果我不能,这个 php 中的问题: http ://www.speedyshare.com/S4QRj/Automation.php
我认为在这段代码中:
private function returnunitsComplete() {
global $database;
$time = time();
$q = "SELECT * FROM ".TB_PREFIX."movement, ".TB_PREFIX."attacks where ".TB_PREFIX."movement.ref = ".TB_PREFIX."attacks.id and ".TB_PREFIX."movement.proc = '0' and ".TB_PREFIX."movement.sort_type = '4' and endtime < $time";
$dataarray = $database->query_return($q);
foreach($dataarray as $data) {
$tribe = $database->getUserField($database->getVillageField($data['to'],"owner"),"tribe",0);
if($tribe == 1){ $u = ""; } elseif($tribe == 2){ $u = "1"; } elseif($tribe == 3){ $u = "2"; } elseif($tribe == 4){ $u = "3"; } else{ $u = "4"; }
$database->modifyUnit(
$data['to'],
array($u."1",$u."2",$u."3",$u."4",$u."5",$u."6",$u."7",$u."8",$u."9",$tribe."0","hero"),
array($data['t1'],$data['t2'],$data['t3'],$data['t4'],$data['t5'],$data['t6'],$data['t7'],$data['t8'],$data['t9'],$data['t10'],$data['t11']),
array(1,1,1,1,1,1,1,1,1,1,1)
);
$database->setMovementProc($data['moveid']);
}
有时返回单位和报告重复。对不起,我的英语不好。谢谢...