_Dynosawr_ Posted June 9, 2012 Group: Members Topic Count: 11 Topics Per Day: 0.00 Content Count: 69 Reputation: 10 Joined: 05/14/12 Last Seen: June 26, 2012 Share Posted June 9, 2012 So I have an issue with the DELETE FROM syntax in Query_SQL. Here's the script: http://pastebin.com/raw.php?i=ABv0KBWF Hopefully once of you can figure out what's wrong with it ;o Quote Link to comment Share on other sites More sharing options...
Euphy Posted June 9, 2012 Group: Members Topic Count: 72 Topics Per Day: 0.02 Content Count: 2997 Reputation: 1132 Joined: 05/27/12 Last Seen: June 1, 2017 Share Posted June 9, 2012 Remember that you only put single quotes (') around strings, not integers, so these parts need to be changed: WHERE `id` = '"+.@f+"'" Didn't look at the rest of it yet, but see if that fixes the problem. Quote Link to comment Share on other sites More sharing options...
plankt Posted June 9, 2012 Group: Members Topic Count: 7 Topics Per Day: 0.00 Content Count: 130 Reputation: 43 Joined: 12/11/11 Last Seen: July 16, 2017 Share Posted June 9, 2012 (edited) You can actually have quotes (') around integers, it's not recommended but often easier if you don't know if you're using strings or integers. Often with dynamic content. The delete statement in MySQL is "DELETE FROM <table> WHERE <where condition>" So you would not get (adding extra spaces for clarity) "DELETE `" + .@b$[.@c] + "` FROM `" + .@g$ + "` WHERE `id` = ' " + .@f + " ' " But rather (not totally sure what the variables are but I'm guessing .@b$ is the field) "DELETE FROM `" + .@g$ + "` WHERE `" + .@b$[.@c] + "` = ' " + .@f + " ' " Edited June 9, 2012 by plankt 1 Quote Link to comment Share on other sites More sharing options...
Brian Posted June 9, 2012 Group: Members Topic Count: 75 Topics Per Day: 0.02 Content Count: 2223 Reputation: 593 Joined: 10/26/11 Last Seen: June 2, 2018 Share Posted June 9, 2012 You can use single-quotes around integers and the query will still work. http://pastebin.com/raw.php?i=ABv0KBWF query_sql("DELETE `"+.@b$[.@c]+"` FROM `"+.@g$+"` WHERE `id` = '"+.@f+"'"); In DELETE queries, you do not specify columns. Just "DELETE FROM" and it means delete the whole row. query_sql("DELETE FROM `"+.@g$+"` WHERE `id` = '"+.@f+"'"); Quote Link to comment Share on other sites More sharing options...
_Dynosawr_ Posted June 9, 2012 Group: Members Topic Count: 11 Topics Per Day: 0.00 Content Count: 69 Reputation: 10 Joined: 05/14/12 Last Seen: June 26, 2012 Author Share Posted June 9, 2012 Well if I can't delete the column then that rules out the delete data option x.x; Thanks for the help though guys. Quote Link to comment Share on other sites More sharing options...
Brian Posted June 9, 2012 Group: Members Topic Count: 75 Topics Per Day: 0.02 Content Count: 2223 Reputation: 593 Joined: 10/26/11 Last Seen: June 2, 2018 Share Posted June 9, 2012 Are you trying to clear a certain column? You could use "UPDATE `table` SET `column`=0, `column2`='' WHERE ..." Quote Link to comment Share on other sites More sharing options...
_Dynosawr_ Posted June 9, 2012 Group: Members Topic Count: 11 Topics Per Day: 0.00 Content Count: 69 Reputation: 10 Joined: 05/14/12 Last Seen: June 26, 2012 Author Share Posted June 9, 2012 I'll try it ;P Quote Link to comment Share on other sites More sharing options...
Question
_Dynosawr_
So I have an issue with the DELETE FROM syntax in Query_SQL.
Here's the script: http://pastebin.com/raw.php?i=ABv0KBWF
Hopefully once of you can figure out what's wrong with it ;o
Link to comment
Share on other sites
6 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.