MySQL string to variable
#2

I'm no expert with the mySQL plugin or SQL itself but in my callback I just have this:

pawn Код:
new rows, fields;
cache_get_data(rows, fields);

// Check if account exists
if(rows)
{
    new temp[256];

    // Load an integer
    cache_get_field_content(0, "SomeFieldName", temp);
    pInfo[playerid][some_var] = strval(temp);

    // Load a string directly into an enum/array structure
    cache_get_field_content(0, "AnotherFieldName", pInfo[playerid][some_string]);
}
else
{
    // No account, prompt to register or whatever
}
I wouldn't use the 'field ID' thing as what if you add a field between other fields? Then your entire order messes up.
Reply


Messages In This Thread
MySQL string to variable - by Wesley221 - 29.04.2013, 18:17
Re: MySQL string to variable - by MP2 - 30.04.2013, 08:33
Re: MySQL string to variable - by AndreT - 30.04.2013, 08:51
Re: MySQL string to variable - by MP2 - 30.04.2013, 08:53
Re: MySQL string to variable - by AndreT - 30.04.2013, 10:19
Re: MySQL string to variable - by MP2 - 30.04.2013, 10:42
Re: MySQL string to variable - by AndreT - 30.04.2013, 12:30
Re: MySQL string to variable - by MP2 - 30.04.2013, 12:37
Re: MySQL string to variable - by Wesley221 - 30.04.2013, 13:48
Re: MySQL string to variable - by Wesley221 - 02.05.2013, 15:24
Re: MySQL string to variable - by Calabresi - 02.05.2013, 18:07
Re: MySQL string to variable - by Wesley221 - 02.05.2013, 18:13
Re: MySQL string to variable - by Calabresi - 02.05.2013, 18:19
Re: MySQL string to variable - by Wesley221 - 02.05.2013, 18:24
Re: MySQL string to variable - by Calabresi - 02.05.2013, 18:28
Re: MySQL string to variable - by Wesley221 - 02.05.2013, 18:35
Re: MySQL string to variable - by Calabresi - 02.05.2013, 18:48
Re: MySQL string to variable - by Wesley221 - 02.05.2013, 19:37
Re: MySQL string to variable - by Wesley221 - 03.05.2013, 17:43
Re: MySQL string to variable - by Scenario - 03.05.2013, 17:51
Re: MySQL string to variable - by Wesley221 - 03.05.2013, 19:32
Re: MySQL string to variable - by InfiniTy. - 03.05.2013, 19:41
Re: MySQL string to variable - by Wesley221 - 03.05.2013, 20:32
Re: MySQL string to variable - by InfiniTy. - 03.05.2013, 20:51
Re: MySQL string to variable - by Wesley221 - 04.05.2013, 13:54
Re: MySQL string to variable - by InfiniTy. - 04.05.2013, 14:39
Re: MySQL string to variable - by Wesley221 - 04.05.2013, 15:13
Re: MySQL string to variable - by Wesley221 - 05.05.2013, 14:16

Forum Jump:


Users browsing this thread: 1 Guest(s)