Jump to content

areoslasher

Members
  • Posts

    4
  • Joined

  • Last visited

areoslasher's Achievements

Vic

Vic (3/54)

1

Reputation

  1. [BUMP] such a stupid mistake, forgot to pass the query
  2. So basically I'm trying to get all of my data from my database to create bank markers around the city but for some reason I'm really having difficult time with this.. I don't understand why is this error happening but anyways.. I'll post snippet of the code and errors down below.. thanks in advanced addEventHandler('onResourceStart', resourceRoot, function() local db = exports.database:getConnectionToDb() dbQuery(loadAllBanks, db, 'SELECT * FROM banks') end) function loadAllBanks() local results = dbPoll(queryHandle, 0) for i,marker in pairs(results) do local bankMarkerObj = createMarker(marker.x, marker.y, marker.z, "cylinder", 1.5, 100, 255, 100, 50 ) setElementData(bankMarkerObj, "id", marker.id) if(marker.isATM == 1) then setElementData(bankMarkerObj, "type", 'ATM') else setElementData(bankMarkerObj, "type", 'Bank') end end end and errors: " WARNING: money\bank.lua:4 Bad argument @'dbPoll' [Expected db-query at argument 1, got nil] " "ERROR: money\bank.lua:5: Bad argument #1 to 'pairs' (table expected, got boolean)" More info: error happens cuz of dbPoll not getting it's query and that's why I need help. yes, I have tried dbFree the query should return one row at the moment **NOTE** local results are not that tabbed in, the snippet got messed up
  3. Wow man that was extremely helpful, I will go through the code and try to let it sink in.. I really appreciate taking your time, thank you very much! -hope you don't mind if I pm you if I don't understand something? If that's not okay just let me know, I wouldn't want to bother you. You helped me more than I expected!
  4. So hi guys, I've been lately working on some scripts just for fun to get familiar with this concept of creating my own resources and now I would like to ask you if someone could explain to me how can I get data from a database and then compare that data with let's say something like account name of a player. Yes, I know I'm supposed to use dbQuerry and dbPoll but I just can't get it to work, so if you'd be so kind to show me in a simple example how to compare the two I'd be really grateful. So let's say the problem is how can I compare user account name and maybe a ownerName(of a house perhaps or a car) which is stored in my database
×
×
  • Create New...