0
我有三個表 1.用戶數據庫使用用戶名& HOME_TEAM 2.用戶點與point_scored & user_name具有與total_points,USER_NAME,match_played_count match_no 3.用戶的性能,home_team_wins_count如何使用phpmysql形式插入多個數據?
我在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 for php/MySQL。
你能顯示你的插入查詢嗎? – auicsc 2013-04-06 19:39:46
$ playupuser3 []是我的數組,它獲取所有發佈的值並使用$ cond給出的條件插入數據庫 – AshaKD 2013-04-06 19:44:40
在每次迭代時檢查'mysql_error()':if(!$ query){echo mysql_error();}'那將明確哪些失敗以及爲什麼。 – auicsc 2013-04-06 19:47:10