Jump to content
×
×
  • Create New...
  • 0

[LUA]Mysql_Query() not counting rows


Lorthir

Question

5 answers to this question

Recommended Posts

  • 0
  • Premium

yes

 

The query is correct. Can you show us what you're doing with "kills" after the query executed? Also make sure your quest can use mysql queries via mysql_query() function :)

 

I'm trying after that to make and if statment comparing a number and the return of the query! example:

if kills >= 3 then
 syschat("hi")
end

Link to comment
Share on other sites

  • 0
  • Premium

Well of course this won't work because mysql_query returns table (if you are using mijago's function). You propably wan't to do it like this:

local kills = mysql_query("SELECT COUNT(*) FROM database.table")[1][1]
  • Love 3
Link to comment
Share on other sites

  • 0

Hello!

 

I'm trying to count the number of entries that I've in this table, but my function isnt working!

local kills = mysql_query("SELECT COUNT(*) FROM database.table")

Can anybody fix this?

 

local kills = mysql_query("SELECT COUNT(*) FROM database.table")

local row = table.getn(kills)

say("Kill : "..row)

 

 

try this

Link to comment
Share on other sites

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


Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.