gvanassche
10-25-2009, 02:40 AM
Dear all,
I'm creating a tool that collects URLs. But I don't want to store them twice in the db. To prevent this from happening, this is what I made:
for row in db:nrows("SELECT url FROM URLTABLE") do
if url ~= newurl then
num=num+1
else
Dialog.Message("Sorry", "you already submitted this URL before.", MB_OK, MB_ICONEXCLAMATION);
preventadding=1
end
end
I think that I use the completly wrong way to retrieve the URLs that are stored in the db, but I have no clue.
I tried this as well:
local url = SQLite.QueryToTable(db, "SELECT url FROM ML")
if url and url.Rows then
for i,v in url.Rows do
Dialog.TimedMessage("url", tblRS, 100, MB_ICONNONE);
end
end
... but the SQLite.QueryToTable does not seem to work.
I'm really not good with this....
Can anyone give me a hint or correct my code?
thanks
gert
I'm creating a tool that collects URLs. But I don't want to store them twice in the db. To prevent this from happening, this is what I made:
for row in db:nrows("SELECT url FROM URLTABLE") do
if url ~= newurl then
num=num+1
else
Dialog.Message("Sorry", "you already submitted this URL before.", MB_OK, MB_ICONEXCLAMATION);
preventadding=1
end
end
I think that I use the completly wrong way to retrieve the URLs that are stored in the db, but I have no clue.
I tried this as well:
local url = SQLite.QueryToTable(db, "SELECT url FROM ML")
if url and url.Rows then
for i,v in url.Rows do
Dialog.TimedMessage("url", tblRS, 100, MB_ICONNONE);
end
end
... but the SQLite.QueryToTable does not seem to work.
I'm really not good with this....
Can anyone give me a hint or correct my code?
thanks
gert