01.01.2015, 16:07
(
Последний раз редактировалось rickisme; 02.01.2015 в 03:01.
)
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
Server console will print
So, if i use your code ( /DestroyDealership 0 )
Query will like this :
And guess what, result is
cause there's no row have column DsID value = 0
but if i replace your code with this :
Query will like this :
Result will be :
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++
}
}
}
pawn Код:
DealerShip ID: 0 (SQLID: 2) loaded
pawn Код:
mysql_format(dbHandle, query, sizeof(query), "DELETE FROM `dealerships` WHERE `DsID` = %d", id);
pawn Код:
DELETE FROM `dealerships` WHERE `DsID` = 0
pawn Код:
[ ! ] Invalid DEALERSHIP ID.
but if i replace your code with this :
pawn Код:
mysql_format(dbHandle, query, sizeof(query), "DELETE FROM `dealerships` WHERE `DsID` = %d", DS[id][DsID]);
pawn Код:
DELETE FROM `dealerships` WHERE `DsID` = 2
pawn Код:
[ ! ] Successfully DELETED DealerShip ID: 0. (SQL-ROW-ID: 2)