Jump to content

BusDunk

Members
  • Posts

    4
  • Joined

  • Last visited

Everything posted by BusDunk

  1. Hello, I have an issue about recovering the ID. I wanted to create a bagback system with a line in the table foreach bag. So I want to recover the ID of the bagback at the moment of its creation in the database. This is my code : local sql = dbQuery(handler,"SELECT * FROM bag") local resultTable = dbPoll(sql, -1) if resultTable then for rowNum, rowData in ipairs(resultTable) do local bID = rowData['ID'] local newID = bID + 1 dbExec(handler,"INSERT INTO bag (TYPE) VALUES ('1')") outputChatBox("ADD BAGBACK ID "..newID.."",source,125,0,0,true) This is the result of what I've done : The script creates several lines with different ID instead of one line only Thanks in advance for your help beacause it impedes me on the progress of my script. PS : I'm a LUA beginner and I am learnig it by myself.
  2. Thank you. I solved my problem thanks to your help. I'm still a script beginner and it's been the second time you helped me. I thank you a lot.
  3. Hello, my problem is that I cannot get back a data from my database. When I try to do it with a dbExec and tostring, it only answers "true" local test = tostring(dbExec(handler,"SELECT favorite_color FROM players")) outputChatBox("Your favorite color is : "..test.." ", source, 125,0,0) ChatBox shows : Your favorite color is : true I would like the ChatBox to display (for example) : Your favorite color is : red
  4. Hello, I'm currently learning how to script by myself and i'm running into difficulties. My problem is that I cannot put a table into a condition. I would like my variable to be equal to one of my table's datas. Here is what I've done : table = {1,2,3,4,5} variable = guiCreateEdit(50, 50, 50, 21, "", false) if variable == table then outputChatBox("test",125,0,0) else outputChatBox("problem",125,0,0) end ChatBox shows : problem
×
×
  • Create New...