SA-MP Forums Archive
MySQL column question. - 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: MySQL column question. (/showthread.php?tid=426950)



MySQL column question. - PaulDinam - 30.03.2013

I there anyway to make 1 column with 5 ints? like 0 | 0 | 0 | 0 | 0 |

I've seen a gamemode before with this...
instead of making 5 column, and how can I load them into integers using BlueG plugin


Re: MySQL column question. - Scenario - 30.03.2013

Using sscanf.


Re: MySQL column question. - Riddy - 30.03.2013

Quote:
Originally Posted by RealCop228
Посмотреть сообщение
Using sscanf.
Like he said, in example:

pawn Код:
forward LoadData(playerid, intid);
public LoadData(playerid, intid)
{
    new query[70], Data[70], int1, int2, int3, int4;
    format(query, sizeof(query), "SELECT int1, int2, int3, int4 FROM int_table WHERE intid = '%d'", intid);
    mysql_query(query);
    mysql_store_result();
    mysql_fetch_row_format(Data, "|");
    if(sscanf(Data, "p<|>iiii", int1, int2, int3, int4)) return print("Error loading the integers");
    mysql_free_result();
    return 1;
}



Re: MySQL column question. - Vince - 30.03.2013

What exactly are you trying to do? Putting multiple values in a single field is almost never a good idea, except if you are working with bitflags.