undefined symbol - 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: undefined symbol (
/showthread.php?tid=631192)
undefined symbol -
Face9000 - 25.03.2017
I'm using Blueg's MYSql R41-2 and i have this code:
pawn Код:
public OnLoginDate(extraid, username[])
{
if (!IsPlayerConnected(extraid))
return 0;
static
rows,
fields,
date[36];
cache_get_data(rows, fields, g_SQL);
if (rows) {
cache_get_row(0, 0, date, g_SQL);
new buf[128];
format(buf, sizeof(buf), "%s's last login was on: %s", username,date);
SendClientMessage(extraid,COLOR_RED, buf);
}
else {
SendClientMessage(extraid,COLOR_RED, "Invalid username specified.");
}
return 1;
}
That gives me:
pawn Код:
error 017: undefined symbol "cache_get_data"
error 017: undefined symbol "cache_get_row"
Also in this stock:
pawn Код:
stock SQL_ReturnEscaped(const string[])
{
new
entry[256];
mysql_real_escape_string(string, entry, g_iHandle);
return entry;
}
Always undefined symbol mysql_real_escape_string.
Re: undefined symbol -
X337 - 25.03.2017
cache_get_data, cache_get_row and mysql_real_escape_string aren't MySQL R41-2 functions.
You can use cache_get_row_count to get total rows, cache_get_value_* to get field values, and mysql_escape_string or use %e specifier in mysql_format to escape string.
Re: undefined symbol -
Sibuscus - 25.03.2017
Код:
new rows;
cache_get_row_count(rows);
if(rows)....
Check this link for more details, it helped me enormously:
https://sampforum.blast.hk/showthread.php?tid=616103
Re: undefined symbol -
Face9000 - 25.03.2017
pawn Код:
public OnLoginDate(extraid, username[])
{
if (!IsPlayerConnected(extraid))
return 0;
static
rows,
fields,
date[36];
cache_get_value(rows, fields, g_SQL);
if (rows) {
cache_get_row_count(0, 0, date, g_SQL);
new buf[128];
format(buf, sizeof(buf), "%s's last login was on: %s", username,date);
SendClientMessage(extraid,COLOR_RED, buf);
}
else {
SendClientMessage(extraid,COLOR_RED, "Invalid username specified.");
}
return 1;
}
Same.
Re: undefined symbol -
AndySedeyn - 26.03.2017
You've got a few things wrong:
PHP код:
cache_get_row_count(&destination)
Takes only a single function argument. Usage:
PHP код:
new
rows;
cache_get_row_count(rows);
All of these can be found on the wiki, by the way:
https://sampwiki.blast.hk/wiki/MySQL/R40
I by accident removed half of my post, but cache_get_value is used to retrieve a value from the result query set and not the row count.