cliftonbazaar Posted February 7, 2010 Share Posted February 7, 2010 Wierd thing has happened and I am stumped as too what is causing it. I have a SQL statement that is only updating certain fields, my code is - $sql = "UPDATE matches SET bat2 = '{$match['homeTeam']}', inningsScore1 = '{$currentScore}', display1stInningsScore = '{$temp}', awayTotalScore = '{$currentScore}', currentBowler='{$match['homeOpeningBowler']}', waitingBowler='{$match['homeOtherBowler']}', currentWickets=0, batterStriker=1, batterNonStriker=2, batterOnStrike=1, ballAge=0, currentInningsScore=0, currentInnings='{$match['currentInnings']}' WHERE matchID='{$match['matchID']}' if I echo the sql statement just before it updates then it shows the following UPDATE matches SET bat2 = 'Darwin Desserters', inningsScore1 = '0', display1stInningsScore = '0', homeTotalScore = '0', currentBowler='11', waitingBowler='10', currentWickets=0, batterStriker=1, batterNonStriker=2, batterOnStrike=1, ballAge=0, currentInningsScore=0, currentInnings='2' WHERE matchID='73' Now the problem is that currentWickets=0, batterStriker=1, batterNonStriker=2, batterOnStrike=1, ballAge=0, currentInningsScore=0 fields DO NOT UPDATE!! I know this because I look straight at the database after it updates and I have checked each field, each field that was a variable updates fine but those fields that update with an Integer do not update. Any suggestions? All I have tried so far is to put '' around the integers currentWickets='0', batterStriker='1', batterNonStriker='2', batterOnStrike='1', ballAge='0', currentInningsScore='0' but that doesn't work either. EDIT: I HAVE SOLVED THIS PROBLEM - ANOTHER FUNCTION WAS BEING CALLED (WHICH WASN'T SUPPOSED TO BE) AND CHANGING ALL THE VALUES BACK! Quote Link to comment https://forums.phpfreaks.com/topic/191235-fields-not-being-updated/ 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.