Jump to content

Weird Problem


jcbarr

Recommended Posts

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.