MYSQL QUESTION
#1

Well, i don't know whats wrong.

Example:

we 2 players are playing in server.

If player 1 quits his/her game then database saved player 1 stats and it does apply for player 2 also even tho player 2 didn't quit yet.

it's like if any player quit his/her game then it changes all player stats in database as quitter stats.

What kind of problem it is? Do you think it's because i am saving stats as ID? like WHERE ID=%s? Should i saved player stats as NAME? or what.

please reply fast.
Thank you
Reply
#2

Give us your Save account data codes here
Reply
#3

ID is a number not a string. Replace %s with %i.
Reply
#4

==================== fixed
Reply
#5

anyone? i need it fast
Reply
#6

==================== fixed
Reply
#7

Someone please help me.
Reply
#8

==================== fixed
Reply
#9

Anyone please help me. It has been 18 hours. IS SAMP DIED?
Reply
#10

Pls stop using so long arrays for so small querys.
And ID must be auto increcement
PHP код:
public SavePlayerData(playerid

    if(
IsLoggedIn[playerid] && IsPlayerConnected(playerid) && !IsPlayerNPC(playerid)) 
    { 
        new 
query[200];
        
mysql_format(mysql,query,sizeof(query),"UPDATE users SET Admin='%d',Donator='%d',RegularPlayer='%d',Money='%d',BankMoney='%d',\
        Score='%d',Deaths='%d',Kills='%d' WHERE ID ='%d'"
,pData[playerid][pAdmin],pData[playerid][pDonator],pData[playerid][pRegularPlayer],
        
GetPlayerCash(playerid),pData[playerid][pBankMoney],GetPlayerScore(playerid),pData[playerid][pDeaths],pData[playerid][pKills],pData[playerid][pID]);
        
mysql_tquery(mysqlquery); 
    } 
    return 
1

Reply
#11

==================== fixed
Reply
#12

Really so bad. nobody wants to help me. I m stuck at this and I SAID ITS URGENT! Thanks you all.
Reply
#13

You have to change this Admin`=%d to Admin='%d'
for every single one
Reply
#14

Quote:
Originally Posted by STONEGOLD
Посмотреть сообщение
Really so bad. nobody wants to help me. I m stuck at this and I SAID ITS URGENT! Thanks you all.
So your issue is more important than everyone else's? Would you like me to bring the limo around for you too sir?
Reply
#15

Quote:
Originally Posted by CodeStyle175
Посмотреть сообщение
You have to change this Admin`=%d to Admin='%d'
for every single one
No, that is not correct. They are integers. They do not require quotes around them. Similarly, the backticks (`) around the field name are optional, but correct.
Reply
#16

You forgot to strcat the last part of your query..
Reply
#17

Which one?

you mean this?
PHP код:
mysql_format(mysqltmpsizeof(tmp), "WHERE `Username`= '%s'"Name[playerid] );
        
mysql_tquery(mysqlquery""""); 
?
Reply
#18

oh no
PHP код:
mysql_format(mysqltmpsizeof(tmp), "WHERE `Username`= '%s'"Name[playerid] );
strcat(querytmp);
mysql_tquery(mysqlquery); 
Reply
#19

==================== fixed
Reply
#20

anyone
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)