Jump to content

[SOLVED] SQL Problem


SpecT

Recommended Posts

Hey guys!

I'm having a problem with my first sql script/system. So it's a music system. It used to get the songs from XML but since XML isn't good for large data I decided to learn and make it with SQL. So yeah I successfully moved the data from the XML file to the SQL file and it's working good.

The problem is on the loading part - I want to make it in a table and for some reason it gives me an error "attempt to index global "t" (a nil value).

Here is wrong code:

if result then 
        for _, row in ipairs ( result ) do 
            local name, length, played = (row['songName']), row['length'], row['requested'] 
            t[name] = {name,length,played} 
            songData = t 
        end 
    end 
  

It loads normally when its like that :

 t = {name,length,played} 

but doesn't load when its like the above code.

Thanks in advance!

Edited by Guest
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...