_Dynosawr_ Posted June 9, 2012 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
Euphy Posted June 9, 2012 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
plankt Posted June 9, 2012 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
Brian Posted June 9, 2012 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
_Dynosawr_ Posted June 9, 2012 Author 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
Brian Posted June 9, 2012 Posted June 9, 2012 Are you trying to clear a certain column? You could use "UPDATE `table` SET `column`=0, `column2`='' WHERE ..." Quote
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
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.