My values aren't saving into SQL
#1

Please delete, it's fixed!!! Thanks to everyone!
Reply
#2

WHERE ID = %d" you have no reference to your id, I'm not sure how your system indexes users but I'm thinking it should look something like this

pawn Код:
stock savePlayer(playerid) {
    new
        szQuery[512]; // This is the only 512 strign exception, for our queries if we lower it... Then that won't be good...
    format(szQuery, sizeof(szQuery), "UPDATE `players` SET `Money` = '%d', `Score` = '%d', `Admin` = '%d', `Kills` = '%d', `Deaths` = '%d', `Weather` = '%d'", GetPlayerMoney(playerid), GetPlayerScore(playerid), PlayerInfo[playerid][pAdmin], PlayerInfo[playerid][pKills], PlayerInfo[playerid][pDeaths], PlayerInfo[playerid][pWeather]);
    format(szQuery, sizeof(szQuery), "%s, `Skin` = '%d', `Time` = '%d', `Color` = '%d', `Tele` = '%d', `Message` = '%d' WHERE `PlayerName` = '%s'", szQuery, PlayerInfo[playerid][pSkin], PlayerInfo[playerid][pTime], PlayerInfo[playerid][pColor], PlayerInfo[playerid][pColor], PlayerInfo[playerid][pTele], PlayerInfo[playerid][pMessage], ReturnName(playerid));

    mysql_query(szQuery, THREAD_NO_RESULT, playerid, iConnectionHandle);
    return 1;
}
That is to the best of my knowledge I've only used SQLITE but it should be something like that I gather.
Reply
#3

before you replied, I noticed I forgot to define ID.... I did, and it still doesn't work... And ID is just to symbolize ID 1, ID 2, etc.
Reply
#4

Well you were also missing a "," here Admin = %d Kills = %d,
Reply
#5

Here, I edited my code a bit more and this is what it looks like now....
Reply
#6

you forgot to put "," after Admin = %d

try this:
pawn Код:
format(szQuery, sizeof(szQuery), "UPDATE players SET Money = %d, Score = %d, Admin = %d, Kills = %d, Deaths = %d, Weather = %d", GetPlayerMoney(playerid), GetPlayerScore(playerid), PlayerInfo[playerid][pAdmin], PlayerInfo[playerid][pKills], PlayerInfo[playerid][pDeaths], PlayerInfo[playerid][pWeather]);
Reply
#7

I did that, still not working unfortuantly. Check the main topic, i got a new message
Reply
#8

Like I said originally, this "where ID =" doesn't seem right it should be something like "where `PlayerName` =
Reply
#9

Well, I am using Calgon's basic MySQL
https://sampforum.blast.hk/showthread.php?tid=344978

And in the main source itself the line is this
pawn Код:
format(szQuery, sizeof(szQuery), "%s, Interior = %d, Skin = %d WHERE ID = %d", szQuery, playerVariables[playerid][pInterior], playerVariables[playerid][pSkin], playerVariables[playerid][pDBID]);
Reply
#10

Alright I see why your doing that now try using the syntax I posted before.

format(szQuery, sizeof(szQuery), "UPDATE `players` SET `Money` = '%d', `Score` = '%d', `Admin` = '%d', `Kills` = '%d', `Deaths` = '%d', `Weather` = '%d'",
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)