MySQL query issue
#1

So for some reason, when a player drops/buys an item, after the delete/insert query it shows an item or 2 out of your inventory in another players inventory.

I can't seem to see the issue.

Load Query:
PHP Code:
mysql_format(ourConnectionquerysizeof(query), "SELECT * FROM inventory_items WHERE char_id = %i"PlayerInfo[playerid][pDBID]);
    
mysql_tquery(ourConnectionquery"Query_LoadInvItems""i"PlayerInfo[playerid][pDBID]); 
function:Query_LoadInvItems:
PHP Code:
function:Query_LoadInvItems(playeridinvid)
{
    new 
rowsfields
    
cache_get_row_count(rows); 
    
cache_get_field_count(fields);
    
    for (new 
0rowsi++)
    {
        
cache_get_value_name_int(i"items_id"InvItems[i][iItemsID]);
        
cache_get_value_name_int(i"char_id"InvItems[i][iCharID]);
        
cache_get_value_name_int(i"modelid"InvItems[i][iModelID]);
        
cache_get_value_name(i"item_name"InvItems[i][iItemName], 50);
        
cache_get_value_name_int(i"item_amount"InvItems[i][iItemAmount]);
    }

AddToInv(the insert query after purchasing an item):
PHP Code:
function:AddToInv(playeridmodeliditemname[], itemamount)
{
    new 
newinv ReturnInvItems(playerid);
    new 
query[256];
    if(
newinv 16)
    {
        
mysql_format(ourConnectionquerysizeof(query), "INSERT INTO inventory_items (char_id, modelid, item_name, item_amount) VALUES(%i, %i,'%s', %i)"PlayerInfo[playerid][pDBID], modeliditemnameitemamount); 
        
mysql_query(ourConnectionquery); 
        
    }
    else return 
SendErrorMessage(playerid"SERVER: Your inventory is full."); 
    return 
1;

Reply


Messages In This Thread
MySQL query issue - by AlphaPac - 23.09.2017, 17:28
Re: MySQL query issue - by whadez - 23.09.2017, 17:40
Re: MySQL query issue - by AlphaPac - 23.09.2017, 18:15

Forum Jump:


Users browsing this thread: 1 Guest(s)