MYSQL - Create columns. -
DarkLouis - 07.06.2015
Hi all.
I want to create column by pawno.
Table name is: negozio
EXAMPLE USE:
PHP код:
for(new num = 0; num < sizeof(Water); num++)
{
//sizeof(Water) = 30
new string[150];
format(string, sizeof(string), "Water_%d", num);
FUNCTION TO ADD COLUMNS.
}
How to do this?
Re: MYSQL - Create columns. -
Konstantinos - 07.06.2015
Would be more efficient to have 1 table with 30 rows (one row for each) instead of 30 fields.
Vince has written 2 tutorials about table structure design and an example of saving player's weapons (instead of 13 fields, 1 weapon = 1 row). Read those, will help you a lot.
Re: MYSQL - Create columns. -
DarkLouis - 08.06.2015
I'm newbie at MYSQL. There's a metod by PAWNO?
Re: MYSQL - Create columns. -
Sergei - 08.06.2015
You are doing it wrong. Create one table with columns like id, relatedid and value and then store all info in it. Check wordpress or some other script as reference.
As ****** said, SQL is language which you need to learn like you learned pawn. If you don't want to do that, then stay with saving in files.
Re: MYSQL - Create columns. -
DarkLouis - 08.06.2015
Sorry but I'm good at PAWNO. I had Y_INI and now I want to converting into MYSQL.
If I have to store a variable that number is 50, I CAN'T create by manual 50 columns and I want to do it by pawno. So please, post an example post.. so I can understand, thank you.
With Y_INI to store 50 variables, I did:
PHP код:
for(new num = 0; num < sizeof(Water); num++)
{
new string[150];
format(string, sizeof(string), "Water_%d", num);
INI_WriteInt(string, PlayerInfo[playerid][Water][num]);
}
Re: MYSQL - Create columns. -
Sergei - 08.06.2015
As I have told you. You are doing it wrong. Saving in files IS NOT IN ANYWAY SIMILAR to saving in SQL database.
If you don't want to devote time and learn how SQL works, its language, database design, etc stay with INI.
I'm glad you are good with pawno, I hope that is also true for pawn.
Re: MYSQL - Create columns. -
DarkLouis - 08.06.2015
... Thank you for the support. I want to learn but I ask you (and all there) help. Why you don't help me instead?
Tell me how to do it and I'll do everything..
Thank you.