i have a db file and i am using it in my project the problem is when there is no data in it it blocks loading "x" but if i add a data then it doesnt block loading "x" why is that ?
sqlite question
Collapse
X
-
here is the example... i only add one word to it "test" and it works perfect like that, u dont get blocked message but if u delete the word "test" then u will get blocked message with "xxx" aswell... can someone help please ?Last edited by ButtonMaker; 03-06-2009, 10:45 AM.
-
-
Your CheckKeyWord function is badly written though. There is no need to return all entries and then search for a match. Let SQLite do the searching for you.
Code:function CheckKeyWord(strSite) --Select all entries found in the KeyWord table local tSites = SQLite.QueryToTable(db,"SELECT * FROM KeyWord WHERE Title = '"..strSite.."'"); --Do the following if there are entries returned if tSites and tSites.Rows > 0 then return true else return false end end
Code:local strText = Input.GetText("Input1"); if strText ~= "" then local fMatch = CheckKeyWord(strText) if fMatch then Dialog.Message("Notice", "This word is blocked.", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1); else Label.SetText("Label1", strText); end end
Dermot
I am so out of here :yes
Comment
-
-
Code:function CheckKeyWord(strSite) --Select all entries found in the KeyWord table tSites = SQLite.QueryToTable(db,"SELECT * FROM KeyWord"); --Do the following if there are entries returned if tSites and tSites.Rows > 0 then for i,v in tSites.Data do ---compare URL with database keywords nMatch = String.Find(strSite, tSites.Data[i]["Title"], 1, false); if nMatch ~= -1 then break; end end else [B][COLOR="Red"]nMatch = -1[/COLOR][/B] end end
Dermot
I am so out of here :yes
Comment
-
Comment