Delete a Certain Row Using Row ID
#8

This, id != DS[id][DsID]
id = in game id ( can start from 0 )
DS[id][DsID] = sql id ( can start from any number higher than 0 )
Example, in table dealerships, i have 1 row, and value in cloumn DsID is 2
i'm start loading dealerships table by use this code
pawn Код:
mysql_tquery(dbHandle, "SELECT * FROM `dealerships`", "loadDEALERSHIPS");
forward loadDEALERSHIPS();
public loadDEALERSHIPS()
{
    if(cache_num_rows() > 0)
    {
        new i;
        while( i < cache_num_rows())
        {
            DS[i][DsSQLID] = cache_get_field_content_int(i, "DsID", dbHandle);
            printf("DealerShip ID: %d (SQLID: %d) loaded", i, DS[i][DsSQLID]);
            i++
           
        }
    }

}
Server console will print
pawn Код:
DealerShip ID: 0 (SQLID: 2) loaded
So, if i use your code ( /DestroyDealership 0 )
pawn Код:
mysql_format(dbHandle, query, sizeof(query), "DELETE FROM `dealerships` WHERE `DsID` = %d", id);
Query will like this :
pawn Код:
DELETE FROM `dealerships` WHERE `DsID` = 0
And guess what, result is
pawn Код:
[ ! ] Invalid DEALERSHIP ID.
cause there's no row have column DsID value = 0
but if i replace your code with this :
pawn Код:
mysql_format(dbHandle, query, sizeof(query), "DELETE FROM `dealerships` WHERE `DsID` = %d", DS[id][DsID]);
Query will like this :
pawn Код:
DELETE FROM `dealerships` WHERE `DsID` = 2
Result will be :
pawn Код:
[ ! ] Successfully DELETED DealerShip ID: 0. (SQL-ROW-ID: 2)
Reply


Messages In This Thread
Delete a Certain Row Using Row ID - by Ox1gEN - 01.01.2015, 13:21
Re : Delete a Certain Row Using Row ID - by MCZOFT - 01.01.2015, 13:35
Re: Delete a Certain Row Using Row ID - by Vince - 01.01.2015, 13:37
Re: Delete a Certain Row Using Row ID - by Ox1gEN - 01.01.2015, 14:23
Re: Delete a Certain Row Using Row ID - by rickisme - 01.01.2015, 14:48
Re: Delete a Certain Row Using Row ID - by Ox1gEN - 01.01.2015, 15:11
Re: Delete a Certain Row Using Row ID - by Ox1gEN - 01.01.2015, 15:58
Re: Delete a Certain Row Using Row ID - by rickisme - 01.01.2015, 16:07
Re: Delete a Certain Row Using Row ID - by Ox1gEN - 01.01.2015, 17:22
Re: Delete a Certain Row Using Row ID - by rickisme - 02.01.2015, 03:18

Forum Jump:


Users browsing this thread: 2 Guest(s)