steadyfi Posted March 21, 2015 Share Posted March 21, 2015 Hello I wonder how can I check for a string if it exists in a SQL Table ? Can someone show me an example with executeSQLQuery ? Thanks Link to comment
Bonsai Posted March 21, 2015 Share Posted March 21, 2015 Just use WHERE to get the value you want to check. If it returns something useful, its existing. Link to comment
RenanPG Posted March 21, 2015 Share Posted March 21, 2015 qh = dbQuery(conn, 'SELECT * FROM table_name WHERE user_name = ?', user) local result = dbPoll( qh, -1 ) if type(result) == 'table' and #result > 0 then print('This string already exists') end This will return all columns value from the row, replace * for a certain column. Link to comment
JR10 Posted March 21, 2015 Share Posted March 21, 2015 dbPoll with -1 is strongly discouraged. Use callbacks instead. Link to comment
steadyfi Posted March 21, 2015 Author Share Posted March 21, 2015 Thank you all for the replies ! I got it now Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now