MySQL Formats
#2

Use format + strcat. Example:

pawn Код:
new query[256], temp[128], player_name[MAX_PLAYER_NAME];
GetPlayerName(playerid, player_name, MAX_PLAYER_NAME);

format(temp, sizeof(temp), "SELECT `%s`,`%s`,`%s`,`%s`,`%s`");
strcat(query, temp);

format(temp, sizeof(temp), ",`%s`,`%s`,`%s`,`%s`,`%s` FROM `%s`");
strcat(query, temp);

format(temp, sizeof(temp), " WHERE `%s` = '%q'", player_name);
strcat(query, temp);
Note that the specifier "%q" in format, is used to escape a string.
Reply


Messages In This Thread
MySQL Formats - by theonethatownz - 21.03.2016, 17:57
Re: MySQL Formats - by SickAttack - 21.03.2016, 18:13
Re: MySQL Formats - by zPain - 21.03.2016, 18:27
Re: MySQL Formats - by theonethatownz - 21.03.2016, 18:39
Re: MySQL Formats - by zPain - 21.03.2016, 18:49
Re: MySQL Formats - by theonethatownz - 21.03.2016, 19:10
Re: MySQL Formats - by Konstantinos - 22.03.2016, 13:43

Forum Jump:


Users browsing this thread: 1 Guest(s)