MySQL saving
#1

Hi, im a new in MySQL and i wanted to save drift score in database, but it don't work. I tried many ways..

Code:
pawn Код:
{
public DriftCancellation(playerid)
{
    PlayerDriftCancellation[playerid] = 0;
    AnnaRaha(playerid,DriftPointsNow[playerid],0);
    new query[300], pname[24];
    GetPlayerName(playerid, pname, 24);
    format(query, sizeof(query), "UPDATE `playerdata` SET Drift='%i' WHERE user='%s'", DriftPoints[playerid]);
    DriftPointsNow[playerid] = 0;
    DriftPoints[playerid] = 0;
    scores[playerid] = 0;
    TextDrawHideForPlayer(playerid, Chet[playerid]);
    TextDrawHideForPlayer(playerid, ChetP[playerid]);
}
If you want more codes or something then tell me...

In phpmyadmin it don't work:

Hope you see pic
Reply
#2

What version of MySQL plugin are you using ? Try adding this line
pawn Код:
//below
format(query, sizeof(query), "UPDATE `playerdata` SET Drift='%i' WHERE user='%s'", DriftPoints[playerid]);
//the following line
mysql_function_query(YourDatabaseName, query, false, "", "");

//above
DriftPointsNow[playerid] = 0;
Edit: my code works for r7 and versions above.
Reply
#3

Quote:
Originally Posted by Wizzy951
Посмотреть сообщение
What version of MySQL plugin are you using ? Try adding this line
pawn Код:
//below
format(query, sizeof(query), "UPDATE `playerdata` SET Drift='%i' WHERE user='%s'", DriftPoints[playerid]);
//the following line
mysql_function_query(YourDatabaseName, query, false, "", "");

//above
DriftPointsNow[playerid] = 0;
Im using R6
Reply
#4

use this one
pawn Код:
public DriftCancellation(playerid)
{
    PlayerDriftCancellation[playerid] = 0;
    AnnaRaha(playerid,DriftPointsNow[playerid],0);
    new query[300], pname[24];
    GetPlayerName(playerid, pname, 24);
    format(query, sizeof(query), "UPDATE `playerdata` SET Drift='%i' WHERE user='%s'", DriftPoints[playerid], pname);
    mysql_query(query);//u forgot this line
    DriftPointsNow[playerid] = 0;
    DriftPoints[playerid] = 0;
    scores[playerid] = 0;
    TextDrawHideForPlayer(playerid, Chet[playerid]);
    TextDrawHideForPlayer(playerid, ChetP[playerid]);
}
Reply
#5

Quote:
Originally Posted by BroZeus
Посмотреть сообщение
use this one
pawn Код:
public DriftCancellation(playerid)
{
    PlayerDriftCancellation[playerid] = 0;
    AnnaRaha(playerid,DriftPointsNow[playerid],0);
    new query[300], pname[24];
    GetPlayerName(playerid, pname, 24);
    format(query, sizeof(query), "UPDATE `playerdata` SET Drift='%i' WHERE user='%s'", DriftPoints[playerid], pname);
    mysql_query(query);//u forgot this line
    DriftPointsNow[playerid] = 0;
    DriftPoints[playerid] = 0;
    scores[playerid] = 0;
    TextDrawHideForPlayer(playerid, Chet[playerid]);
    TextDrawHideForPlayer(playerid, ChetP[playerid]);
}
Thanks man... It work now.
Reply
#6

format(query, sizeof(query), "UPDATE `playerdata` SET Drift='%i' WHERE user='%s'", DriftPoints[playerid], PlayerNameHere);
mysql_function_query(g_mysql_handle, query, true, "EmptyCallback", "");

//below code is to connect sql and store the info in g_mysql_handle.
g_mysql_handle = mysql_connect(MYSQL_HOST,MYSQL_USER,MYSQL_DATABASE ,MYSQL_PASSWORD);
// use this at your game mode in the top.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)