Jump to content

MySQL query


Recommended Posts


So I am working on an Inventory system and I am trying to get the item amount from an item and when I try to get it, it outputs this to the chat: table: 0x9b1c038

Not sure what this is, but it isn't what I want (I want the number that is under the amount)

This is the sql command I am using:

    local currentAmount = exports.mysqlconfig:querySingle("SELECT itemAmount FROM `playerItems` WHERE `itemName` = ? AND `serial` = ?", name, serial) 
outputChatBox("" .. tostring(currentAmount)) 

I have tried querySingle and query and they both send the same thing.

Link to comment

I'd rather try doing the following:

for k,v in pairs(currentAmount) do 
    outputChatBox(k.." => "..v) 

as it might be possible that it's indexed this way: currentAmount["itemAmount"] instead as "querySingle" probably automatically adds "LIMIT 1" to your actual query (as the function's name contains single). Although, it would be way easier if you show us the mentioned function you're calling.

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