Jump to content

[HELP] db Insert


Snow-Man

Recommended Posts

  
 function addPlayerPunishments(thePlayer)  
local account = getPlayerAccount(thePlayer)  
if (account) and not (isGuestAccount(account)) then  
local accountName = getAccountName(account)  
local serial = getPlayerSerial(thePlayer)  
Local time = getRealTime().timestamp return exports.USCsql:Execdb("INSERT INTO punishlogs (account,serial,time) VALUES(?,?,?)", accountName, serial, time) end return false end 

When i use this export, i didn't found any data in db

Help?

Link to comment

You're defining time with Local. It should be local. If it still doesn't work please post your whole code, and the Execdb function along with any debug errors that are appearing.

function addPlayerPunishments ( source ) 
    local account = getPlayerAccount ( source ) 
    if ( account and not isGuestAccount ( account ) ) then 
        local accName = getAccountName ( account ) 
        local serial = getPlayerSerial ( source ) 
        local time = getRealTime ( ).timestamp 
        local exe = exports.USCsql:Execdb ( "INSERT INTO punishlog ( account, serial, time ) VALUES ( ?, ?, ? )", 
             tostring ( accName ), tostring ( serial ), tostring ( time ) ) 
  
        return exe 
    end 
    return false 
end 

Link to comment
  • 2 weeks later...

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