Help with mysql format
#1

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
Reply
#2

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

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)