SA-MP Forums Archive
MYSQL QUESTION - 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 QUESTION (/showthread.php?tid=581007)

Pages: 1 2


MYSQL QUESTION - STONEGOLD - 09.07.2015

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


Re: URGENT MYSQL QUESTION - Sime30 - 09.07.2015

Give us your Save account data codes here


Re: URGENT MYSQL QUESTION - ExTaZZ69 - 09.07.2015

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


Re: URGENT MYSQL QUESTION - STONEGOLD - 09.07.2015

==================== fixed


Re: URGENT MYSQL QUESTION - STONEGOLD - 09.07.2015

anyone? i need it fast


Re: URGENT MYSQL QUESTION - STONEGOLD - 09.07.2015

==================== fixed


Re: URGENT MYSQL QUESTION - STONEGOLD - 10.07.2015

Someone please help me.


Re: URGENT MYSQL QUESTION - STONEGOLD - 10.07.2015

==================== fixed


Re: URGENT MYSQL QUESTION - STONEGOLD - 10.07.2015

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


Re: URGENT MYSQL QUESTION - CodeStyle175 - 10.07.2015

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




Re: URGENT MYSQL QUESTION - STONEGOLD - 10.07.2015

==================== fixed


Re: URGENT MYSQL QUESTION - STONEGOLD - 10.07.2015

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


Re: URGENT MYSQL QUESTION - CodeStyle175 - 10.07.2015

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


Re: URGENT MYSQL QUESTION - !damo!spiderman - 10.07.2015

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?


Re: URGENT MYSQL QUESTION - ev0lution - 10.07.2015

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.


Re: URGENT MYSQL QUESTION - woot - 10.07.2015

You forgot to strcat the last part of your query..


Re: MYSQL QUESTION - STONEGOLD - 10.07.2015

Which one?

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


Re: MYSQL QUESTION - CodeStyle175 - 10.07.2015

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



Re: MYSQL QUESTION - STONEGOLD - 10.07.2015

==================== fixed


Re: MYSQL QUESTION - STONEGOLD - 10.07.2015

anyone