SA-MP Forums Archive
Help with mysql format - 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: Help with mysql format (/showthread.php?tid=555605)



Help with mysql format - MrViolence101 - 08.01.2015

Hi guys, i have a little problem that shows up in my mysql log and i dont know where the code is wrong, can i get some help from you guys to tell me where the problem in my script could be?

Код:
[14:31:04] [ERROR] mysql_format - no value for specifier "%s" available
[14:39:18] [ERROR] mysql_format - no value for specifier "%s" available
[14:39:46] [ERROR] mysql_format - no value for specifier "%s" available
[14:44:13] [ERROR] mysql_format - no value for specifier "%s" available
[14:44:38] [ERROR] mysql_format - no value for specifier "%s" available
[14:50:36] [ERROR] mysql_format - no value for specifier "%s" available
[14:51:24] [ERROR] mysql_format - no value for specifier "%s" available



Re: Help with mysql format - Vince - 08.01.2015

This is like going to the insurance company and only saying "someone hit my car". Who, what, when, where?
More information and CODE, please.


Re: Help with mysql format - PowerPC603 - 08.01.2015

You have queries in which you have a %s specifier, but you don't supply any variable after your query to replace the %s with.

Like this:
pawn Код:
mysql_format(SQL_db, Query, sizeof(Query), "SELECT * FROM playerdata WHERE PlayerName = '%s'");
The %s must be replaced by some value stored in a variable, but after the query, you don't specify a variable that contains the data, which should be inserted where the %s is located.

This would be correct:
pawn Код:
new Name[24];
GetPlayerName(playerid, Name, sizeof(Name));
mysql_format(SQL_db, Query, sizeof(Query), "SELECT * FROM playerdata WHERE PlayerName = '%s'", Name);
As the player's name would be stored in the "Name" variable and will be inserted at the location of the %s.