Save with mysql in one line.
#1

Hi,

Now i think that can to do just one field, and write there everything name,xp and other stuff like that

Код:
Name_SurName | 50000 | 10 | Infinitive | 0
And then load in one field, and set XP with what is in first | an so on. I think you understand. But how do it properely.
Reply
#2

Yes you can, just save that as string, something like that:
Код:
IP|XP|MONEY|LEVEL|ETC
But you need at least 2 field, with name and others.
When you load it from mysql:
Код:
SELECT /*THAT STRING*/ FROM /*YOUR TABLE*/ WHERE NAME = '%s'
And I think you know how to format it.
And now, you need sscanf.
Код:
new String[256];
cache_get_constant_row(0,"/*THAT STRING*/",String);
sscanf(String,"...");
Give that what you want to save or you need to work alone now.
Reply
#3

But it'is hard, because if i store strings which player can to write, but of course am escaping them, but still if i'am separate then with | or other symbol, if that string will be will be | then read from then and bugged loading and saving.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)