Nortonic Posted July 4, 2013 Posted July 4, 2013 Hello! Thank you for taking your time to look at this. I have a Roleplay server, And everything is goin well, Exept the login. In the console when i hit Login, I get this: attempt to compare number with boolean Here is where it says the error is: local accountCheckQuery = mysql:query(accountCheckQueryStr) if mysql:num_rows(accountCheckQuery)>0 then accountData = mysql:fetch_assoc(accountCheckQuery) mysql:free_result(accountCheckQuery) Please help, Thanks in advanced!
Moderators IIYAMA Posted July 4, 2013 Moderators Posted July 4, 2013 local accountCheckQuery = mysql:query(accountCheckQueryStr) -- get database account Script problem: mysql:num_rows(accountCheckQuery) -- returns boolean = false/true at the moment if mysql:num_rows(accountCheckQuery)>0 then -- here you are comparing the boolean with the number 0. and how the solve it? I have no idea, because this is the result from something that went wrong at another part of the script. Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
dudeks Posted July 5, 2013 Posted July 5, 2013 if mysql:num_rows(accountCheckQuery)>0 then is bad use if accountCheckQuery:num_rows() > 0 then all: local accountCheckQuery = mysql:query(accountCheckQueryStr) if accountCheckQuery:num_rows() > 0 then accountData = mysql_fetch_assoc(accountCheckQuery) accountCheckQuery:free_result()
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