Jump to content

Problema con "Query"


depato123

Recommended Posts

Hola, hace mucho que no poseo nada. Bueno el problema es este.

function escape_string( str ) 
    if type( str ) == "string" then 
        return mysql_escape_string( connection, str ) 
    elseif type( str ) == "number" then 
        return tostring( str ) 
    end 
end 
  
function query_free( str, ... ) 
    if sourceResource == getResourceFromName( "runcode" ) then 
        return false 
    end 
     
    checkConnection( ) 
     
    if ( ... ) then 
        local t = { ... } 
        for k, v in ipairs( t ) do 
            t[ k ] = escape_string( tostring( v ) ) or "" 
        end 
        str = str:format( unpack( t ) ) --aquí está el problema 
    end 
     
    local result = mysql_query( connection, str ) 
    if result then 
        mysql_free_result( result ) 
        return true 
    end 
    return false, mysql_error( connection ) 
end 

El problema es que str me da nil. No entiendo porque hace 5 horas que estoy con este script

PD: Gracias por leer y si pueden ayudarme se los agradecería

Otro PD: query_free es un export y está todo correctamente exportado, el problema es que al llamarlo desde otro resource me da "nil value"

Link to comment
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...