Jump to content

[HELP]attempt to compare table


DenizD

Recommended Posts


--261		local dbid   = getElementData(thePlayer, "dbid")
--262		local cek    = exports.mysql:query_fetch_assoc( "SELECT `chip` FROM `characters` WHERE `id`=" .. mysql:escape_string(dbid) )
--263
--264
--265		if not amount >= cek then
--266			outputChatBox("chip ?", thePlayer)
--267			return false
--268		end	

[2021-10-21 00:39:38] ERROR: [R]\test-system\test.lua:265: attempt to compare table with boolean

or

[2021-10-21 00:39:38] ERROR: [R]\test-system\test.lua:265: attempt to compare table with string

Edited by DenizD
Link to comment
  • DenizD changed the title to [HELP]attempt to compare table

Hello DenizD,

there are multiple issues with your script.

  • The third-party MTA-MySQL module is outdated. Please use the dbConnect family of functions instead.
  • MySQL queries return a table of multiple possible results. You have to decide which result you want to work with. In the most common scenario it is enough to just get the first-indexed entry of the table (result[1]) and use that one for your code.
  • You have used a non-existant function of an unsupported library. Please use new functions instead. I recommend you to use the dbQuery function.

Good luck and have fun! ?

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...