我有三个表 1. 带有用户名和 home_team 的用户数据库 2. 带有 point_scored 的用户点和带有 match_no 的用户名 3. 带有 total_points、user_name、match_played_count、home_team_wins_count 的用户性能
我在数据库中有 2500 个用户。
首先,我通过表单和代码部分发布了 match_no 和获胜团队,我在下面的代码中使用了它,它可以工作,但在更新 400-500 条记录后查询停止工作。我找不到解决方案?我检查了它的流量,但它是正确的。我的邮政编码是这样的:
<?php
require("../includes/commonClass.php");
$classObj = new commonclass;
$postedData = $classObj->getRequestedData();
$setsession = $classObj->validsessionmanager();
if(isset($_POST['submitht']))
{
$mid = $postedData['match'];
$winteam = $postedData['team1'];
$classObj->getUserTable();
$condht="home_team='".$winteam."'";
$resultht = $classObj->selectSql($condht);
$rowht = $classObj->fetchData($resultht);
foreach($rowht as $rowsht)
{
$username=$rowsht['user_name'];
$playupuser2['home_team_win']=1;
$playupuser2['total_points']=10;
$playupuser2['match_played']=1;
$classObj->getUSerPerformanceTable();
$classObj->userPostedData = $playupuser2;
$cond1 = "user_name='".$username."'";
$insert_query = $classObj->updateData1($cond1);
$playupuser3['point_scored']=10;
$playupuser3['ht_status']=1;
$classObj->getUserPointTable();
$classObj->userPostedData = $playupuser3;
$cond2 = "user_name='".$username."' AND match_no='".$mid."'";
$insert_query = $classObj->updateData1($cond2);
}
if($insert_query == "success")
{
echo "<script> alert ('Home team Upadated Sucessfully'); </script>";
echo "<script>window.location='hometeamUpdate.php'</script>";
}
}
else
{
echo "<script> alert ('Error Occured ')</script>";
}
?>
它适用于 100-200 条记录,并在更新后显示适当的警报。我将 xampp 用于 php/MySQL。