SA-MP Forums Archive
MySQL take string from table - 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 take string from table (/showthread.php?tid=622800)



MySQL take string from table - Vaki - 26.11.2016

I want to take string "ImeClana" from table http://prntscr.com/dc5uaj and to compare with one string which i insert in script..But i dont know how to take string from table good..So i did on this way but isnt very well

Quote:

format(nikoopet, sizeof(nikoopet), "NIKO");
format(query, sizeof(query), "SELECT `ImeClana` FROM `organizacije` WHERE `Slot` = '%d' AND `ImeOrganizacije` = '%s'", slot,ImeOrganizacije(PlayerInfo[para1][Lider]));
mysql_tquery(mysql, query, "", "");
cache_get_field_content(0, "ImeClana", niko);
if(strcmp(niko, nikoopet)) return SCMF(playerid, -1, ""CRVENA"[SA:RP]:"BELA"Neko se vec nalazi na slotu %d!",slot);




Re: MySQL take string from table - Micko123 - 26.11.2016

try with
PHP код:
cache_get_field_name(0"ImeClana"niko50); 
Trebalo bi da radi


Re: MySQL take string from table - d1git - 26.11.2016

If you're using the latest version of the plugin.
Код:
new 
    string[24];

cache_get_value_name(0, "ImeClana", string);



Re: MySQL take string from table - Vaki - 26.11.2016

Doesnt work,and i am using Mysql R39-3


Re: MySQL take string from table - feartonyb - 26.11.2016

FIX:
Код:
new clanime[MAX_PLAYER_NAME], nikoopet[MAX_PLAYER_NAME] = "NIKO";
cache_get_field_content(0, "ImeClana", clanime);
if(strcmp(clanime,"nikoopet",true) == 0) return SCMF(playerid, -1, ""CRVENA"[SA:RP]:"BELA"Neko se vec nalazi na slotu %d!",slot);



Re: MySQL take string from table - Vaki - 27.11.2016

I work on this way,because cant on the way which you write here..But anyway thank you
This is on CMD:INVITE:
Quote:

format(query, sizeof(query), "SELECT `ImeClana` FROM `organizacije` WHERE `Slot` = '%d' AND `ImeOrganizacije` = '%s'", slot,ImeOrganizacije(PlayerInfo[para1][Lider]));
mysql_tquery(mysql, query, "ProveriSlot", "i", playerid);

This is on forward public:
Quote:

forward ProveriSlot(playerid);
public ProveriSlot(playerid)
{
new clanime[50], nikoopet[MAX_PLAYER_NAME] = "NIKO";
cache_get_field_content(0, "ImeClana", clanime);
SlotPrazan[playerid] = 1;
if(strcmp(clanime,nikoopet)) return SCM(playerid, -1, ""CRVENA"[SA:RP]:"BELA"Neko se vec nalazi na slotu!"),SlotPrazan[playerid] = 0;
return 1;
}