Jump to content
  • 0

Question

6 answers to this question

Recommended Posts

Posted

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.

Posted (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 by plankt
  • Upvote 1
Posted

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+"'");

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...