SA-MP Forums Archive
MySQL Query, Issue. Won't delete fields. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: MySQL Query, Issue. Won't delete fields. (/showthread.php?tid=480311)



MySQL Query, Issue. Won't delete fields. - Dokins - 10.12.2013

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.


Re: MySQL Query, Issue. Won't delete fields. - arakuta - 10.12.2013

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



Re: MySQL Query, Issue. Won't delete fields. - Dokins - 10.12.2013

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