douzhuan1467 2013-04-06 18:11
浏览 48

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

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.

  • 写回答

1条回答 默认 最新

  • drra6593 2013-04-06 19:34
    关注

    May be the execution time is over. You will edit this line

    $cfg['ExecTimeLimit'] = 600;
    

    to higher value in xampp\phpMyAdmin\libraries\config.default.php. Also look this link

    评论

报告相同问题?

悬赏问题

  • ¥15 BP神经网络控制倒立摆
  • ¥20 要这个数学建模编程的代码 并且能完整允许出来结果 完整的过程和数据的结果
  • ¥15 html5+css和javascript有人可以帮吗?图片要怎么插入代码里面啊
  • ¥30 Unity接入微信SDK 无法开启摄像头
  • ¥20 有偿 写代码 要用特定的软件anaconda 里的jvpyter 用python3写
  • ¥20 cad图纸,chx-3六轴码垛机器人
  • ¥15 移动摄像头专网需要解vlan
  • ¥20 access多表提取相同字段数据并合并
  • ¥20 基于MSP430f5529的MPU6050驱动,求出欧拉角
  • ¥20 Java-Oj-桌布的计算