MYSQL - Create columns.
#1

Hi all.


I want to create column by pawno.

Table name is: negozio

EXAMPLE USE:
PHP код:
for(new num 0num sizeof(Water); num++)
{
//sizeof(Water) = 30
new string[150];
format(stringsizeof(string), "Water_%d"num);
FUNCTION 
TO ADD COLUMNS.

How to do this?
Reply
#2

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.
Reply
#3

I'm newbie at MYSQL. There's a metod by PAWNO?
Reply
#4

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.
Reply
#5

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 0num sizeof(Water); num++) 

new 
string[150]; 
format(stringsizeof(string), "Water_%d"num); 
INI_WriteInt(stringPlayerInfo[playerid][Water][num]);

Reply
#6

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.
Reply
#7

... 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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)