Quantcast
Channel: SA-MP Forums
Viewing all articles
Browse latest Browse all 18226

Fetching a data from mySQL

$
0
0
Hello there!

I recently started working with mySQL querys. And I'm facing a problem. I need to fetch a data from my database (player's skin) but I don't know how exactly.

My player skin saves perfectly, and here is the code:
Code:

  new playerSkin = GetPlayerSkin(playerid);
    new query[70];
    mysql_format(g_SQL, query, sizeof query, "UPDATE `players` SET `skin` = %d WHERE `id` = %d LIMIT 1", playerSkin, Player[playerid][ID]);
    mysql_tquery(g_SQL, query);

I don't know what should I do to make it work, I tried adding a _tempskin to storage somewhere fetched data and later on I can set the skin but it returns CJ skin.
Code:

new query[70];
    new _tempskin;
    mysql_format(g_SQL, query, sizeof query, "SELECT FROM `players` WHERE `skin` = %d LIMIT 1", _tempskin);
    mysql_tquery(g_SQL, query);
    SetPlayerSkin(playerid, _tempskin);

Thanks!!

Viewing all articles
Browse latest Browse all 18226

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>