Mysql cache_get_value() mismatching arguments. - 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 cache_get_value() mismatching arguments. (
/showthread.php?tid=656410)
Mysql cache_get_value() mismatching arguments. -
Seifspeed - 15.07.2018
I am getting errors when using cache_get_value() with MySQL 41-4.
Here is the tquery:
Код:
mysql_tquery(g_SQL, "SELECT * FROM usertest WHERE name = 'Dave'", "SeifSelectCallback");
Код:
forward SeifSelectCallback();
public SeifSelectCallback() {
new id;
new name[25];
if (cache_num_rows() > 0) {
cache_get_value(0, "id", id, 10);
cache_get_value(0, "name", name, 25);
}
print("Id:");
print(id);
print("Name:");
print(name);
return 1;
}
Here are the errors:
Код:
gamemodes/test.pwn(101) : error 035: argument type mismatch (argument 3)
gamemodes/test.pwn(105) : error 035: argument type mismatch (argument 1)
gamemodes/test.pwn(98) : warning 203: symbol is never used: "id"
i can't figure this out especially because I can't find documentation for R41-4. Thanks in advance!!
Re: Mysql cache_get_value() mismatching arguments. -
Calisthenics - 15.07.2018
"id" is integer, not a string.
pawn Код:
cache_get_value_int(0, "id", id);
and
Re: Mysql cache_get_value() mismatching arguments. -
Iguman - 15.07.2018
This should work.
PHP код:
mysql_tquery(g_SQL, "SELECT * FROM `usertest` WHERE `name` = 'Dave'", "SeifSelectCallback");
forward SeifSelectCallback();
public SeifSelectCallback()
{
new id, name[25];
if (cache_num_rows())
{
cache_get_value_name_int(0, "id", id);
cache_get_value_name(0, "name", name, sizeof(name));
}
printf("ID: %d, Name: %s", id, name);
return 1;
}