Jump to content

Recommended Posts

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!

Link to comment
https://forums.phpfreaks.com/topic/191235-fields-not-being-updated/
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.