Jump to content

Problema salvare


EnAcHe

Recommended Posts

Nu mi se salveaza pinul in baza de date.

Tabelul e creat sub forma  `Pin` varchar(10) NOT NULL DEFAULT '0',

Eu am facut o salvare cam asa:

  1. #define pPinx               110

case pPinx:

{
mysql_format(SQL, var, sizeof(var), "UPDATE `users` SET `Pin`='%d' WHERE `name`='%s'",PlayerInfo[playerid][pPin], PlayerInfo[playerid][pNormalName]);
mysql_tquery(SQL,var,"","");
}
 
Update(playerid, pPinx);
Link to comment
Share on other sites

Nu e suficient ce ai facut tu, trebuie sa preiei din baza de date datele.

ex:

new query[500];

format(query,100,"SELECT * FROM users WHERE `name`='%s' AND `Pin`='%s'",PlayerInfo[playerid][pNormalName],PlayerInfo[playerid][pPin]);

new Cache: pin = mysql_query(SQL,query);

if(cache_get_row_count() > 0)
{
        cache_get_field_content(0, "name", PlayerInfo[playerid][pNormalName], SQL, 130);

        PlayerInfo[playerid][pPin] = cache_get_field_content_int(0, "Pin");

}

Spoiler

Alte informatii:  

1. Daca esti in ceata, ce am scris mai sus il poti pune la OnPlayerLogin

2. E foarte probabil sa ai in gamemode aceste salvari si sa fii nevoit sa adaugi doar 'PlayerInfo[playerid][pPin] = cache_get_field_content_int(0, "Pin");'

 

 

Edited by Alberto.
Link to comment
Share on other sites

syntaxa nu e corecta, trebuia sa verifici mysql.log . 

mysql_format(SQL, var, sizeof(var), "UPDATE users SET Pin=%d WHERE name='%s'",PlayerInfo[playerid][pPin], PlayerInfo[playerid][pNormalName]);
mysql_query(SQL,var);
Asa e corect formulat !

Cea mai sigura sursa de facut bani de buzunar in mediul virtual. Inregistreaza-te si pune-te pe treaba !!!

http://www.viespar.ro/?reff=ab8e9d8086304d6136eac03c710238d7

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.