SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 25/03/2017, 12:46 AM   #1
Face9000
Banned
 
Join Date: Jan 2010
Location: Pigland
Posts: 3,351
Reputation: 190
Default undefined symbol

I'm using Blueg's MYSql R41-2 and i have this code:

pawn Code:
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 Code:
error 017: undefined symbol "cache_get_data"
error 017: undefined symbol "cache_get_row"

Also in this stock:

pawn Code:
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.
Face9000 is offline   Reply With Quote
Old 25/03/2017, 05:28 AM   #2
X337
Gangsta
 
Join Date: Sep 2014
Location: Indonesia
Posts: 872
Reputation: 291
Default Re: undefined symbol

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.
__________________
viva la sa-mp
X337 is offline   Reply With Quote
Old 25/03/2017, 08:23 AM   #3
Sibuscus
Little Clucker
 
Join Date: Mar 2014
Posts: 46
Reputation: 4
Default Re: undefined symbol

Code:
new rows;
cache_get_row_count(rows);
if(rows)....
Check this link for more details, it helped me enormously: http://forum.sa-mp.com/showthread.php?t=616103
Sibuscus is offline   Reply With Quote
Old 25/03/2017, 08:59 PM   #4
Face9000
Banned
 
Join Date: Jan 2010
Location: Pigland
Posts: 3,351
Reputation: 190
Default Re: undefined symbol

pawn Code:
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.
Face9000 is offline   Reply With Quote
Old 26/03/2017, 12:12 AM   #5
AndySedeyn
High-roller
 
AndySedeyn's Avatar
 
Join Date: Feb 2014
Location: Belgium
Posts: 1,207
Reputation: 681
Default Re: undefined symbol

You've got a few things wrong:
  • PHP Code:
    cache_get_row_count(&destination
    Takes only a single function argument. Usage:
    PHP Code:
    new
        
    rows;

    cache_get_row_count(rows); 

All of these can be found on the wiki, by the way: http://wiki.sa-mp.com/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.

Last edited by AndySedeyn; 26/03/2017 at 03:44 AM.
AndySedeyn is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
I get multiple errors on the include MSelection [UNDEFINED SYMBOL AND SYMBOL IS NEVER USED] Gorgeousmaniac Scripting Help 2 21/08/2016 06:31 PM
symbol lookup error: plugins/mysql.so: undefined symbol: compress Grzechuso Scripting Help 2 06/01/2016 03:52 PM
error 017: undefined symbol "ReadPlayer" and error 017: undefined symbol "WritePlayer" brandypol Scripting Help 8 26/08/2014 06:16 PM
undefined symbol and symbol is assigned a value that is never used Proph3t Scripting Help 2 11/04/2013 02:54 PM
[HELP]Undefined symbol errors when symbol is defined PCheriyan007 Help Archive 9 07/07/2011 01:09 AM


All times are GMT. The time now is 11:12 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.