undefined symbol
#1

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

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

Код:
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
Reply
#4

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)