MySQL Query, Issue. Won't delete fields.
#1

pawn Код:
new query[128];
        format(query, sizeof(query), "DELETE VehModel, VehOwner, VehSpawnX, VehSpawnY, VehSpawnZ,VehSpawnAngle, VehColour1, VehColour2, VehFuel, VehPlate, VehWep1,VehWepA1,VehWep2,VehWepA2, VehCash, VehArmour, VehFaction, VehFRank, VehOwned, VehFactioned FROM `vehicles` WHERE `id` = %d", VehicleSQLID[vehicleid]);
        mysql_query(query);
        new rows = mysql_affected_rows();
       
        if(rows > 0)
        {
            new string[128];
            format(string, sizeof(string), "{FF0000}Vehicle Deleted.");
            strcat(string, "Vehicle Server ID: {FF0000}%d", vehicleid);
            strcat(string, "Vehicle MySQL ID: {FF0000}%d", VehicleSQLID[vehicleid]);
            strcat(string, "Next Free SQLID: {FF0000}%d", GetFreeMySQLSlot("vehicles"));
            SendClientMessage(playerid, COLOUR_WHITE, string);
        }
Not sure why it won't delete.

Quote:

[03:20:33] mysql error 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
The line in question is the query itself.
Reply
#2

Do you wanna clean these colums or delete the entire row?

To clean columns, make it equal 0 using UPDATE.

If you want to remove the entire row:

pawn Код:
"DELETE FROM `table` WHERE id=10" // example
Reply
#3

Ahhh thank you, it's update in that case.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)