Question on UPDATE

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
dwessell
Forum Commoner
Posts: 62
Joined: Fri Dec 23, 2005 2:30 pm

Question on UPDATE

Post by dwessell »

Hi all..

Code: Select all

"UPDATE `ItemInformation` SET `LastItem` = 0, `ItemUsed` = 0 WHERE `GameNumber` = $row[0] AND `TeamNumber` = $row[1] AND `LastItem` = 1";

With this code, it's updating `LastItem`, but not `ItemUsed`. Is that becuse I have one of the conditions as `LastItem` = 1. And when that changes to 0, it's no longer true?

Thanks
David
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

Im not entirely sure about this, but try switching the order in your query

Code: Select all

"UPDATE `ItemInformation` SET `ItemUsed` = 0, `LastItem` = 0 WHERE `GameNumber` = $row[0] AND `TeamNumber` = $row[1] AND `LastItem` = 1";
dwessell
Forum Commoner
Posts: 62
Joined: Fri Dec 23, 2005 2:30 pm

Post by dwessell »

Hey Pimptastic..

I surely did, but to no avail. The critera are being met, thus the one column being changed.. But I'm at a loss as to why that other column isn't changing too.. I've verified that the column name is correct, it's a TinyInt, so a 0 shouldn't throw it off..

Truely stumped.. :)

Thanks
David
Post Reply