Posts: 734
Threads: 8
Joined: Jun 2009
Quote:
Originally Posted by FireCat
Like it's setting everyone's column the same, the column "TrashMasterMissions"
pawn Код:
static gQuery[60]; format(gQuery,sizeof gQuery,"UPDATE `Accounts` SET `TrashMasterMissions` = '%i' WHERE `ID` = '%i' LIMIT 1;",PInfo[playerid][TrashMasterMissions],PInfo[playerid][ID]); mysql_query(gQuery);
|
For starters the syntax is wrong, I mean, drop the ' around integer values, '' are used to enclose strings, just use %i, or %d. Then print the ID to see if there's anything wrong that might set the same values for every user.
Oh and, stop using static keyword for mysql queries, use new to declare a new variable.
Posts: 734
Threads: 8
Joined: Jun 2009
Quote:
Originally Posted by FireCat
No, the syntax is not wrong. To set values you must use '.
And I prefer using static when messing around with strings.
|
Yeah, it is, you don't use '' for integers, only for strings. And trust me on that, when I used static with mysql queries, things got strange..
Posts: 734
Threads: 8
Joined: Jun 2009
Quote:
Originally Posted by FireCat
I'm not using " for integers, I'm using '
And I found the problem!
It was the size of the variable (cells)
pawn Код:
[17:26:48] CMySQLHandler::Query(UPDATE `Accounts` SET `TrashMasterMissions` = '3' WHERE `ID) - An error has occured. (Error ID: 1054, Unknown column 'ID' in 'where clause')
|
Well good for you! Now for the love of Christ, never ever ever put integer value inside single quotes like this:
SELECT * FROM `some_table` WHERE `something` = '1'. NO, you don't do it like that, you never put integers inside single quotes like you do with strings, ask anyone you want. Instead you make it like this: SELECT * FROM `some_table` WHERE `something` = 1