Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

COMPARE ID VALUE
Started by jjrey95 Jan 29 2019 02:27 PM

3 replies to this topic
[TOPIC CONTROLS]
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

jjrey95

[GLOBAL: userInfoPane.html]
jjrey95
  • Observer

  • 29 posts
  • Corona SDK

Hi, i have a question, I need compare the id value of table with a number variable, is this possible? how do it?



[TOPIC: post.html]
#2

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 26,205 posts
  • Enterprise

Hello and welcome to the Corona community forums. Since this started as a support ticket, here is what I responded there:

 

If you have a table like: myTable.id and id is a number you can simply do:

if myTable.id == youNumericId then
    -- whatever you need to do
end

Rob

 

 


[TOPIC: post.html]
#3

jjrey95

[GLOBAL: userInfoPane.html]
jjrey95
  • Observer

  • 29 posts
  • Corona SDK

Yes, I understand than but I have a sql table, I have use the option [[DELETE * FROM tabla WHERE id==value]], how do that?



[TOPIC: post.html]
#4

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 26,205 posts
  • Enterprise

Something like:

[[DELETE * FROM tabla WHERE id=]] .. value

[[ and ]] are just a type of quote around the SQL query string.

.. is the string concatenation operator

 

assuming value is a number and your SQL id field is a number, that will work. If id is a string, you would need some additional quotes like this:

[[DELETE * FROM tabla WHERE id="]] .. value .. [["]]

Rob




[topic_controls]
[/topic_controls]