如何使用phpmysql表单插入多个数据?

时间:2013-04-06 18:11:14

标签: php javascript mysql

我有三张桌子 1.用户数据库,用户名&主队 2.用point_scored&的用户点user_name with 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。

1 个答案:

答案 0 :(得分:0)

可能是执行时间结束了。您将编辑此行

$cfg['ExecTimeLimit'] = 600;

到xampp \ phpMyAdmin \ libraries \ config.default.php中的更高值。 另请查看此link