SA:MP MySQL Sscanf
#1

I use sscanf to read data from mysql, it's like this (example):

Код:
sscanf(linestring, "iiis[24]iiiifff", var1, var2, var3, var4, var5, var6, var7, var8, var9, var10, var11);
That was just an example, I have much more variables and they are stored at PlayerInfo[playerid][Variable].

The problem is I want to put more data in mysql but then I can't read it because I oversize.

Is there a solution to read more variables with sscanf like breaking a part or something?
Reply
#2

Help?
Reply
#3

What version are you using? I believe you are using MySQL r6 below there's another way to load it but it doesn't use sscanf

pawn Код:
new
    string [ 70 ]; // variable

mysql_store_result(); // store the sql result
if(mysql_num_rows() != 0) // row checking
{ // opening bracket
    while(mysql_fetch_row_format(Query, "|")) //loop and divider
    { // opening bracket
        mysql_fetch_field_row(string, "row0"); var1 = strval(string); //load row 1

        mysql_fetch_field_row(string, "row1"); var2 = strval(string); // load row 2

        mysql_fetch_field_row(string, "row2"); var3 = strval(string); // load row 3
    } // closing bracket
    mysql_free_result(); // free the result
} // closing bracket
else // else statement
{
    //code
}
Reply
#4

Depends on what you're actually loading and where from. I'd advise against using more than 30 fields in a single table. If you have field names with number (e.g. weapon1, weapon2, ...) then you should move those to another table so you can make rows instead of columns.
Reply
#5

I am using sscanf for faster loading and I don't want to change it. I already used get_field and I switched from it on sscanf
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)