好吧,所以即時嘗試做一個簡單的交易腳本我一直在試圖找到問題數週,現在我已決定尋求幫助。我從數據庫中選擇一些怪物以及交易信息,例如交易的來源以及交易的對象。該腳本雖然沒問題,並說它已完成,但不做2次更新。它需要從數據庫中抓取怪物,然後更新那裏的所有者。我有會話開始和DB在頁面的頂部連接是對任何人說,這是問題PHP while循環出錯
} else if ($_POST['Submit'] == 'Complete') {
//// This is the bit which does the update and does not work
$TradeID = $_POST['id'];
$sql12 = mysql_query("SELECT * FROM Trades WHERE ID='$TradeID'");
$row12 = mysql_fetch_array($sql12) or die(mysql_error());
$unserialize11 = unserialize($row12['MyPokemon']);
foreach ($unserialize11 as $poke222) {
$sql2 = mysql_query("SELECT * FROM user_pokemon WHERE id='$poke222'");
while ($row2 = mysql_fetch_array($sql2)) {
$Update1 = mysql_query("UPDATE user_pokemon SET belongsto='".$row12['Me']."' WHERE id='".$row2['ID']."'");
}
}
$unserialize12 = unserialize($row12['OtherPokemon']);
foreach ($unserialize12 as $poke122) {
$sql3 = mysql_query("SELECT * FROM user_pokemon WHERE id='$poke122'");
while ($row3 = mysql_fetch_array($sql3)) {
$Update1 = mysql_query("UPDATE user_pokemon SET belongsto='".$row12['OtherPerson']."' WHERE id='".$row3['ID']."'");
}
}
echo "You have successfully completed trade #".$TradeID."!";
}
} else if ($_GET['action'] == 'delete'){
我剛纔剪斷的這些工作不被抓住怪物不錯,但僅僅是代碼位沒有進行更新,我想也許我得到了錯誤的地方}或可能有很多?
這是對舊服務器的某種壓力測試嗎?另外,你有沒有嘗試**學習SQL **?!它看起來像你甚至不能寫一個簡單的'JOIN'語句。 – 2012-04-07 15:01:38
你是什麼意思壓力測試? – user1121083 2012-04-07 15:02:56
https://en.wikipedia.org/wiki/Stress_testing_(software) – 2012-04-07 15:04:13