databaseSearchNames is not working for me. I am not sure what I am doing wrong. The search for first or last name is not working for me. Actually it seems to work on some cases but not others.
For example if I search for "art" in then I get results but when I search for "rel" I should at least get the name "Darrel" but I don't.
Could anyone spot what is wrong with my code below. Also is the solution going to be posted. I wanted to compare my code against solution but I couldn't find it.
Thank you in advance for your help.
Sincerely,
------------------------------------------
on databaseSearchNames
--answer "in SearchName"
put the uText of group "searchText" into tSearchText
--answer tSearchText
put empty into field "contacts"
if the uOptionText of group "databaseType" is "SQLite" or the uOptionText of group "databaseType" is "Direct MySQL" then
--answer "In if"
put empty into field "contacts"
put "SELECT firstname,lastname,contact_id FROM contacts" into tSQLQuery
put " WHERE firstname LIKE '%" & tSearchText & "%' OR lastname LIKE '%" & tSearchText & "%'" after tSQLQuery
--put " WHERE firstname LIKE '%" & tSearchText & "%'" after tSQLQuery
--answer tSQLQuery
put revDataFromQuery(tab,return,sDatabaseConnectionID,tSQLQuery) into tContacts
else if the uOptionText of group "databaseType" is "Web MySQL" then
end if
put tContacts into field "contacts"
end databaseSearchNames
Lesson 3 - databaseSearchNames?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Re: Lesson 3 - databaseSearchNames?
Please post here the query in plain words created by your script, so we can have a look.
With :
With :
Code: Select all
answer tSQLQuery
Re: Lesson 3 - databaseSearchNames?
I found the the problem. I think I a typo in the SQL string. It is working now.
Thank you
Thank you