MySql
#1

PHP код:
SaveInventory(playerid)
{
    new 
_query[73];
    
    
mysql_format(handle_querysizeof(_query), "DELETE FROM `Inventory` WHERE `PlayerID` = %d"pInfo[playerid][pID]);
    
mysql_tquery(handle_query);
    for(new 
ii<pInventory[playerid][iUsedSlots]; i++)
    {
        if(
pInventory[playerid][iItemAmount][i] > 0)
        {
            
mysql_format(handle_querysizeof(_query), "INSERT INTO `Inventory` VALUES (%d, %d, %d)"pInfo[playerid][pID], pInventory[playerid][iItems][i], pInventory[playerid][iItemAmount][i]);
            
mysql_tquery(handle_query);
        }
    }
    
    return 
1;

This is code for the player inventory. Once the player pick up an item it will save in this database: http://prntscr.com/jwphpc

As you can see, it makes another line, same id and the new item.

I wanted to change it work into this new database which have "PlayerId>Inv_1,_inv_2..., and so on up to Inv_50.

I want to change this query so every item the user picks up it will save to the next slot. Example a user pick up an item, it will save on "Inv_1", but if he picks up another item(doesn't matter if its the same or not) it should same to the next slot which is "Inv_2".

How do I do that? Thanks.
Reply


Messages In This Thread
MySql - by DarkMythHunter - 19.06.2018, 12:16
Re: MySql - by Calisthenics - 19.06.2018, 12:37
Re: MySql - by DarkMythHunter - 19.06.2018, 13:14

Forum Jump:


Users browsing this thread: 1 Guest(s)