PDA

View Full Version : Help with mysql format


MrViolence101
08/01/2015, 12:24 PM
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

Vince
08/01/2015, 12:52 PM
This is like going to the insurance company and only saying "someone hit my car". Who, what, when, where?
More information and CODE, please.

PowerPC603
08/01/2015, 01:11 PM
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:

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:

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.