I have three tables 1. User database with username & home_team 2. User points with point_scored & user_name with match_no 3. User performance with total_points, user_name, match_played_count, home_team_wins_count
I have 2500 numbers of user in database.
First I post match_no & winning team through form and in code section I used below code, it works but after updating 400-500 records query stop working. I cant find solution? I check its flow but its proper. My postcode is like :
<?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>";
}
?>
Its properly work for 100-200 records and show proper alerts after updating. I used xampp for php/MySQL.