Jump to content

SQL Query


Recommended Posts


I'm trying to avoid concatenating a string to send it as a query for MySQL, So I have this code:

local result = dbPoll(dbQuery(dbHandler, "SELECT ? FROM `stats` WHERE `account`=?", column, accName), -1) 

It says:

- table

- 0

I can't access the value returned..

Link to comment

Well, I don't know if it cause anything but it is good to try:

"SELECT `?` FROM `stats` WHERE `account`=`?`" 

Also make sure that 'column' gives correct value and there is such a column in database. Check if DB connection works fine, too.

Link to comment

Change query to

SELECT ? FROM stats WHERE account=?

I think it can work.

Or if not work

SELECT ? FROM stats WHERE account='?'

And this is what i am using

local result = dbPoll(dbQuery(dbHandler, "SELECT '"..column.."' FROM stats WHERE account='"..accName.."'"), -1)

Link to comment
local result = dbPoll(dbQuery(dbHandler, "SELECT '"..column.."' FROM stats WHERE account='"..accName.."'"), -1)

That's what I'm trying to avoid.. (Concatenating a string)

result[1].account -- 1 is the column, if there's many column you can just put number of it 
--account is the row name 

I'm sure that this works 100%

It won't work since the table returned is empty

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...