Jump to content

Select all lines from Table [Help Please]


Annas

Recommended Posts

Posted

Hi all, This code select Line 1 Only from Table_Name(skinsShaders) , i need it to select all lines ..

filename[1].shaderid 

As far as i know, the problem is here.. the [1] means select from line 1 only..

I tried to remove it

filename.shaderid 

But it's not working..

The Code(Server Side):

function downloadPlayerAlternatexx(p, _) 
    local filename = exports.DENmysql:query("SELECT * FROM skinsShaders") 
  
    theskinId = filename[1].shaderid 
  
    if (#filename > 0 ) then 
    fetchRemote("http://localhost/shadersqsdqs/"..filename[1].shaderid..".jpg", checkPlayerAlternateSkin) 
    end 
end 
addCommandHandler("additsx", downloadPlayerAlternatexx) 

Please help me.

Posted
for i=1, #filename do  
-- 
    local theskinId = filename[i].shaderid 
    outputDebugString(tostring(theskinId)) 
-- 
end 

?

https://www.lua.org/pil/4.3.4.html

Not working, please help ..

function downloadPlayerAlternatexx(p, _) 
    local filename = exports.CSTmysql:query("SELECT * FROM skinsShaders") 
    for i=1, #filename do 
    local theskinId = filename[i].shaderid 
  
    fetchRemote("http://localhost/shadersqsdqs/"..tostring(theskinId)..".jpg", checkPlayerAlternateSkin) 
    end 
end 
addCommandHandler("additsx", downloadPlayerAlternatexx) 

  • Moderators
Posted

I can't help you if everything is correct. You have to be more specific.

AND DEBUG YOUR CODE MANUALLY LIKE I DID FOR YOU!

outputDebugString(tostring(theskinId)) 
Posted

Not working man!

Attempt to concatenate local 'theskinId' (a nil value)

Code:

function downloadPlayerAlternatexx(p, _) 
    local filename = exports.CSTmysql:query("SELECT * FROM skinsShaders") 
    for i=1, #filename do 
    local theskinId = filename[i].shaderid 
    outputDebugString(tostring(theskinId)) 
    fetchRemote("http://localhost/shadersqsdqs/"..theskinId..".jpg", checkPlayerAlternateSkin) 
    end 
end 
addCommandHandler("additsx", downloadPlayerAlternatexx) 

  • Moderators
Posted
outputDebugString("filename[i] = ".. tostring(filename[i])) 
  
if theskinId then 
    fetchRemote("http://localhost/shadersqsdqs/"..theskinId..".jpg", checkPlayerAlternateSkin) 
end 

Posted

Same reason..

Attempt to concatenate local 'theskinId' (a nil value)

Code:

function downloadPlayerAlternatexx(p, _) 
    local filename = exports.DENmysql:query("SELECT * FROM skinsShaders") 
    for i=1, #filename do 
    local theskinId = filename[i].shaderid 
    outputDebugString("filename[i] = ".. tostring(filename[i])) 
    if theskinId then 
        fetchRemote("http://localhost/shadersqsdqs/"..theskinId..".jpg", checkPlayerAlternateSkin) 
    end 
    end 
end 
addCommandHandler("additsx", downloadPlayerAlternatexx) 

  • Moderators
Posted

You can't have the same reason, because of line 6. nil values are not allow to pass line 6.

Pls restart everything correctly.

You probably have some data in your db which doesn't have a valid shaderid. Which means you have saved some incomplete/corrupted data.

Validate the file-locations in your db with:

https://wiki.multitheftauto.com/wiki/FileExists

Delete those that do not exist.

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