jcbarr Posted August 12, 2007 Share Posted August 12, 2007 It's been a while since I have posted here, but I am back and I am having a very weird problem. I have this snippet of code; //Get player1 info $sql="SELECT * FROM dbase WHERE DORDER='$swap1'"; $result=mysql_query($sql); $player1=mysql_fetch_array($result); //Get player2 info $sql2="SELECT * FROM dbase WHERE DORDER='$swap2'"; $result2=mysql_query($sql2); $player2=mysql_fetch_array($result2); //Swap Players in dbase $move1="UPDATE dbase SET PID = '{$player2['PID']}', JNUM = '{$player2['JNUM']}', FIRSTNAME = '{$player2['FIRSTNAME']}', LASTNAME = '{$player2['LASTNAME']}', YEARS = '{$player2['YEARS']}', POSITION = '{$player2['POSITION']}', HEIGHT = '{$player2['HEIGHT']}', WEIGHT = '{$player2['WEIGHT']}', POT_SP = '{$player2['POT_SP']}', POT_AC = '{$player2['POT_AC']}', POT_AG = '{$player2['POT_AG']}', POT_ST = '{$player2['POT_ST']}', POT_HA = '{$player2['POT_HA']}', POT_EN = '{$player2['POT_EN']}', POT_IN = '{$player2['POT_IN']}', POT_DI = '{$player2['POT_DI']}', ACT_SP = '{$player2['ACT_SP']}', ACT_AC = '{$player2['ACT_AC']}', ACT_AG = '{$player2['ACT_AG']}', ACT_ST = '{$player2['ACT_ST']}', ACT_HA = '{$player2['ACT_HA']}', ACT_EN = '{$player2['ACT_EN']}', ACT_IN = '{$player2['ACT_IN']}', ACT_DI = '{$player2['ACT_DI']}' WHERE DORDER = '$swap1'"; $adjust1=mysql_query($move1); $move2="UPDATE dbase SET PID = '{$player1['PID']}', JNUM = '{$player1['JNUM']}', FIRSTNAME = '{$player1['FIRSTNAME']}', LASTNAME = '{$player1['LASTNAME']}', YEARS = '{$player1['YEARS']}', POSITION = '{$player1['POSITION']}', HEIGHT = '{$player1['HEIGHT']}', WEIGHT = '{$player1['WEIGHT']}', POT_SP = '{$player1['POT_SP']}', POT_AC = '{$player1['POT_AC']}', POT_AG = '{$player1['POT_AG']}', POT_ST = '{$player1['POT_ST']}', POT_HA = '{$player1['POT_HA']}', POT_EN = '{$player1['POT_EN']}', POT_IN = '{$player1['POT_IN']}', POT_DI = '{$player1['POT_DI']}', ACT_SP = '{$player1['ACT_SP']}', ACT_AC = '{$player1['ACT_AC']}', ACT_AG = '{$player1['ACT_AG']}', ACT_ST = '{$player1['ACT_ST']}', ACT_HA = '{$player1['ACT_HA']}', ACT_EN = '{$player1['ACT_EN']}', ACT_IN = '{$player1['ACT_IN']}', ACT_DI = '{$player1['ACT_DI']}' WHERE DORDER = '$swap2'"; $adjust2=mysql_query($move2); I have tested this several times and everything appears to be in order until one of the swap variables is the number 72. If either one of them carries this value then I end up with two rows of exactly the same thing. If you can't pick it up from the code above, there are two numbers put in to a form. This script then gets them as swap1 and swap2. It then takes all the information out of the row with DORDER value of swap1 and places it in the row with DORDER swap2, it then does the reverse for the other swap number. I have to do it this way because of some very weird formatting requirements that my third party app has to import the database after I export it from myPhpAdmin. Does anyone have any clue as to why the number 72 would be giving this script fits? Quote Link to comment https://forums.phpfreaks.com/topic/64513-weird-problem/ Share on other sites More sharing options...
jcbarr Posted August 13, 2007 Author Share Posted August 13, 2007 No ideas or was my title not descriptive enough to warrant any responses? I kind of thought that might be an issue. Anyway, no other number causes this to happen. But whenever the number 72 is input into the form that feeds this script, I get two rows that mimic what row 72 was previously. Any other number that is put into the form works fine with no errors. Quote Link to comment https://forums.phpfreaks.com/topic/64513-weird-problem/#findComment-322291 Share on other sites More sharing options...
Orio Posted August 13, 2007 Share Posted August 13, 2007 First check if you maybe have two rows where dorder is 72. If you have, you obviously will have two rows equal after the update... If thats not the problem, and if this table isn't big, maybe you can show the data in the table? Orio. Quote Link to comment https://forums.phpfreaks.com/topic/64513-weird-problem/#findComment-322313 Share on other sites More sharing options...
jcbarr Posted August 13, 2007 Author Share Posted August 13, 2007 That is the problem the table is huge. I checked and only one row where dorder is 72...I'm stumped... Quote Link to comment https://forums.phpfreaks.com/topic/64513-weird-problem/#findComment-322635 Share on other sites More sharing options...
lemmin Posted August 13, 2007 Share Posted August 13, 2007 What if you change the number form 72 to something else (maybe a number you know has worked) and see if you still get the error on that row? Quote Link to comment https://forums.phpfreaks.com/topic/64513-weird-problem/#findComment-322642 Share on other sites More sharing options...
jcbarr Posted August 13, 2007 Author Share Posted August 13, 2007 I have done that. It doesn't matter what information is in that particular row, when I use that number it duplicates it instead of swapping it. Any other number combination works except for any that uses the number 72. It really makes no sense to me at all. Quote Link to comment https://forums.phpfreaks.com/topic/64513-weird-problem/#findComment-322821 Share on other sites More sharing options...
Orio Posted August 13, 2007 Share Posted August 13, 2007 How many rows does this table have? I cant see why the number 72 will make troubles unless there's something with it in this table. Orio. Quote Link to comment https://forums.phpfreaks.com/topic/64513-weird-problem/#findComment-322830 Share on other sites More sharing options...
jcbarr Posted August 14, 2007 Author Share Posted August 14, 2007 1,927 rows Quote Link to comment https://forums.phpfreaks.com/topic/64513-weird-problem/#findComment-323050 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.