MySQL bug at some variables..
#1

Hi,

I work on a MySQL system for my GameMode, but some variables doesn't save.. I don't say all variables don't save, just some variables, such as the lign where "Job" is write.

Here the code:
PasteBin

Thanks, I've spend 5 hours on this problem, and don't see where is the problem..
Reply
#2

Make it like

Adminlevel= '%d'
or Banreason= '%s'

it may work

so use '%s' '%d' with the ' '
Reply
#3

Already tried this.. But thanks.
Reply
#4

did it work ?
Reply
#5

Nop, if it work, I actually not request help I've try alot of things.. you can't imagine..
Reply
#6

Save variables when they actually change ...

For example "Registered" is changed only one time since registration, and you plan to save it every time?
Reply
#7

Quote:
Originally Posted by Tigerkiller
Посмотреть сообщение
Make it like

Adminlevel= '%d'
or Banreason= '%s'

it may work

so use '%s' '%d' with the ' '
That won't be necessary. Single quotes are necessary with strings only.

Do what Sergei says and feel free to set more values in one query. There's no trouble having a query with 400 characters, just make sure your string has enough cells.
Reply
#8

No, It's just for test.. but for my test, all data might save.. Such as the line where job is, nothing save on this line.
Reply
#9

Looking at that line:
pawn Код:
format(query, sizeof(query), "UPDATE utilisateurs SET BiggestFish=%d, Job=%d, PayCheck=%d, HeadValue=%d, Jailed=%d, JailTime=%d, Materials=%d WHERE Pseudo='%s'", PlayerInfo[playerid][pBiggestFish], PlayerInfo[playerid][pJob], PlayerInfo[playerid][pPayCheck], PlayerInfo[playerid][pJailed], PlayerInfo[playerid][pJailTime], PlayerInfo[playerid][pMats], PlayerInfo[playerid][pMatsf], pName);
The error is easy to spot. You're missing the variable for HeadValue (after PlayerInfo[playerid][pPayCheck] and before PlayerInfo[playerid][pJailed]). That's why the query is invalid.

A good way to keep track of query errors (and this query _will_ produce one) is through the debug files both MySQL plugins have the option for.

Also, even if just for testing - why something as pointless as that? And 19 queries? Are you kidding me...
Reply
#10

Already tried to edit it, and it doesn't work. And yeah, it's just for test IF I'm abble to save data in the database, I didn't said I don't project to link my GameMode with a website, but, for the moment it's just for testing, I've not MySQL connection system, just this, I just try to update in database.

But, thanks for your help.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)