好的,所以我正在尝试制作一个简单的交易脚本,几周来我一直试图找到问题,现在我决定寻求帮助。我从数据库中选择了一些怪物以及交易信息,例如交易来自谁以及交易对象。该脚本虽然可以并说它已完成,但没有进行 2 次更新。从数据库中获取怪物然后更新那里的所有者。我有会话开始,页面顶部的 db connect 任何人都说这是问题
} 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'){
我刚刚剪掉了一些不起作用的代码,它很好地抓住了怪物,但只是没有进行更新,我想也许我把 }} 放在了错误的地方,或者可能有很多?