SA-MP Forums Archive
MySQL bug at some variables.. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: MySQL bug at some variables.. (/showthread.php?tid=288592)



MySQL bug at some variables.. - Sreadon - 08.10.2011

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..


AW: MySQL bug at some variables.. - Tigerkiller - 08.10.2011

Make it like

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

it may work

so use '%s' '%d' with the ' '


Re : MySQL bug at some variables.. - Sreadon - 08.10.2011

Already tried this.. But thanks.


AW: MySQL bug at some variables.. - Tigerkiller - 08.10.2011

did it work ?


Re : MySQL bug at some variables.. - Sreadon - 08.10.2011

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


Re: MySQL bug at some variables.. - Sergei - 08.10.2011

Save variables when they actually change ...

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


Re: AW: MySQL bug at some variables.. - AndreT - 08.10.2011

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.


Re : MySQL bug at some variables.. - Sreadon - 08.10.2011

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.


Re: MySQL bug at some variables.. - AndreT - 08.10.2011

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...


Re : MySQL bug at some variables.. - Sreadon - 08.10.2011

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.