Delete a Certain Row Using Row ID
#9

Mhm-.. I see.
So I need to use instead of the ID in this:

pawn Код:
mysql_format(dbHandle, query, sizeof(query), "DELETE FROM `dealerships` WHERE `DsID` = %d", id);
with this?

pawn Код:
mysql_format(dbHandle, query, sizeof(query), "DELETE FROM `dealerships` WHERE `DsID` = %d", DS[id][DsID]);
And another thing, what do I do with the pickup, I did as you said, yet it doesn't work.
I probably frustrate you because I do not understand, so sorry about that

pawn Код:
forward destroyDEALERSHIP(playerid, id);
public destroyDEALERSHIP(playerid, id) {
    if(cache_affected_rows(dbHandle) > 0) {
        DestroyPickup(DS[id][DsIcon]); //This part, it doesn't delete the pickup.
        printf("Successfully deleted dealership id %d --", DS[id][DsID]);
        format(ZString, sizeof(ZString), "[ ! ] Successfully DELETED DealerShip ID:%d. (SQL-ROW-ID:%d)", id, DS[id][DsID]); //Thanks to 'rickisme' for helping me with this one.
        SendClientMessage(playerid, COLOR_SUCCESS, ZString);
        mysql_tquery(dbHandle, "SELECT * FROM `dealerships`", "loadDEALERSHIPS");
    } else return SendClientMessage(playerid, COLOR_ERROR, "[ ! ] Invalid DEALERSHIP ID.");
    return 1;
}

forward loadDEALERSHIPS(); //Here's where I fetch all the ds info
public loadDEALERSHIPS() {

    for(new i = 0 ; i < cache_num_rows(dbHandle) ; i++) { // Dealership information - Fetched.

        DS[i][DsID] = cache_get_field_content_int(i, "DsID", dbHandle);
        DS[i][DsLocX] = cache_get_field_content_float(i, "DsLocX", dbHandle);
        DS[i][DsLocY] = cache_get_field_content_float(i, "DsLocY", dbHandle);
        DS[i][DsLocZ] = cache_get_field_content_float(i, "DsLocZ", dbHandle);
        DS[i][DsIcon] = cache_get_field_content_int(i, "DsIcon", dbHandle);

        DS[i][DsIcon] = CreatePickup(1239, 23, DS[i][DsLocX], DS[i][DsLocY], DS[i][DsLocZ], -1); //And here is where I set the icon

    }
    printf("[ OXIGEN's VEHICLES ] [ ! ] Loaded %d DEALERSHIPS", cache_num_rows(dbHandle));
    return 1;
}
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: 1 Guest(s)