xFFrozen Posted March 22, 2018 Share Posted March 22, 2018 Hey I have a Code, which search SQL Database for a result.. Everything works fine, but it only finde ONE result.. What can I do, to have more than one result? My Code: for i=1,8 do local f=dbPoll(dbQuery(handler,"SELECT `Name` FROM `userdata` WHERE Test1 = ? AND Test2 = ?","5",tostring(i)),-1,true) local f=f[1] if f then for k,v in pairs (f) do outputChatBox(v..' TEstTEst ') end end end Link to comment
Skully Posted March 22, 2018 Share Posted March 22, 2018 (edited) Read the wiki page for dbPoll, there's a ton of examples displaying how to fetch results correctly. connection = dbConnect("sqlite", "test.db") queryhandle = dbQuery( connection, 'SELECT * FROM Test1') result = dbPoll(queryhandle, -1) for rid, row in ipairs (result) do -- row represents the tables that are in 'result', which represent the rows for column, value in pairs (row) do -- column represents column name, value represents column value outputChatBox(column..', '..value) end end Edited March 22, 2018 by Skully 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