Hero192 Posted February 12, 2016 Posted February 12, 2016 Hey dear scripters, I wanted to SELECT 2 Tables from the database and those two tables contains with an account name, I want to be able to loop from those two tables in same time. I tried that, function isAccount (acc) if (acc) then local query = dbQuery(connection, "SELECT * FROM vehicles, weapons WHERE vehicles.account='"..tostring(acc).."' AND weapons.account'"..acc.."'LIMIT 1") local result = dbPoll(query,-1) if (type(result) == "table" and #result == 0) or not result then return false else return result[1] end end end --(It's not a full code just showing how I looped the data) ---When I try to loop the data it return false, local result = isAccount(getAccountName(getPlayerAccount(source))) giveWeapon(source, result.slotID0, result.ammoID0) Can any one give me a hand please?
tosfera Posted February 12, 2016 Posted February 12, 2016 Well, if I get what you're trying.. you're actually looking for data that's linked to each other. As in; account linked to character. As far as my knowledge goes, a left join would do but looking at your tables; vehicles, weapons. that's not going to work. You can't just simply get both of these in 1 query, every single join you're going to write will give you massive bugs since these two are very different from each other. If you want to contact me directly concerning Advanced-Gaming, please contact me at [email protected]
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