PDA

View Full Version : saving with loop mysql +Rep


iBots
18/04/2015, 10:32 AM
how is it possible to save something in a file using a loop,instead of putting them all i wanna put like item1 = pinfo[playerid][pitem][0],like this..

Azula
18/04/2015, 10:35 AM
For(new i=0;i !=MAX_PLAYERS -1;i++)
{
item[i+1][playerid] = pinfo[playerid][pitem][i+1];
}

new item[MAX_item][MAX_PLAYERS];

iBots
18/04/2015, 10:48 AM
i meant inserting them to the table

Azula
18/04/2015, 10:57 AM
new dbHandle,query;
mysql_format(dbHandle, query, sizeof(query), "UPDATE `Users` SET `item`='%i',pinfo[playerid][pitem][i+1]);
mysql_tquery(dbHandle, query, "", "");


change Users by your db table name and make sur you have item table created

iBots
18/04/2015, 10:58 AM
i said 'insert' not 'update',come on.

iBots
18/04/2015, 01:59 PM
Anyone?