Zaloguj się by uzyskać pełen dostęp. Nie masz jeszcze konta? Założ je już teraz w kilka sekund.
GTAONLINE.PL
Tematy otagowane jako: stworzeniu
1. Pobranie id "A_I" mysql po stworzeniu rekordu
Witam, czy jest mo?liwo?? pobrania id "A_I" z tabeli odrazu po u?yciu tej funkcji?

local expp exports.mysql:_Exec("insert into pojazdy(model,ownerid) values (?,?)",model,ownerid)


Chodzi o to ?e chce nadac pojazdowi w element dacie jego id kt?re stworzy?o si? automatycznie po to aby potem stworzony pojazd mo?na by?o zapisa? z u?yciem "where id=?".

Dodam jeszcze funkcje z export?w:

local connection 
nil
addEventHandler
("onResourceStart",resourceRoot,function(resource)
        
connection dbConnect("mysql","dbname=******;host=******;port=3306;","******","******")
        if 
connection then
            outputDebugString
("Polaczono z baza danych!")
            return 
true
        
else
            
outputDebugString("Blad podczas laczenia sie z baza danych!")
            return 
false
        end
    end
)

function 
_Query( ... )
    if 
connection then
        local query 
dbQuery(connection, ... )
        
local result dbPoll(query,-1)
        return 
result
    
else
        return 
false
    end
end

function _QuerySingle(str,...)
    if 
connection then
        local result 
_Query(str,...)
        if 
type(result) == 'table' then
            
return result[1]
        
end
    
else
        return 
false
    end
end

function _Exec(str,...)
    if 
connection then
        local query 
dbExec(connection,str,...)
        return 
query
    
else
        return 
false
    end
end