Jump to content

executeSQLQuery Insert ERROR


BigDaddy

Recommended Posts

What's Problem here ?

debugscript :

ERROR: Mute\Ms.lua:24: Database query failed: unrecognized token: ''')'' 
 

addEventHandler('onResourceStart',resourceRoot, 
    function (      ) 
        local CreateNewTable = executeSQLQuery ('CREATE TABLE IF NOT EXISTS  `Mute` ( PlayerSerial,Date,Name,By,Reason ) ') 
            if ( CreateNewTable ) then 
                outputDebugString('Create [ Mute ] DataBase done .') 
        end 
    end 
) 
addEvent("executeSQLQuery:INSERT",true) 
addEventHandler('executeSQLQuery:INSERT',root, 
    function ( Name,Reason,By ) 
    local Serial = getPlayerSerial(Name) 
    local time = getRealTime() 
            local hours = time.hour 
            local minutes = time.minute 
            local days = time.monthday 
            local months = time.month 
            local years = time.year 
            local second = time.second 
            local isdsts = time.timestamp 
            local Date_Time = " [ "..days.." / "..months.." / "..years.."  "..hours..":"..minutes.." : ".. second .." ] " 
    local Results = executeSQLQuery("SELECT * FROM `Mute` WHERE PlayerSerial=?",Serial ) 
     if ( type ( Results ) == "table" and #Results == 0 or not Results ) then 
        executeSQLQuery ( "INSERT INTO `Mute` ( PlayerSerial,Date,Name,By,Reason ) VALUES(?,?,?,?,?)",tostring(Serial),tostring(Date_Time),tostring(By),tostring(Reason)) 
  else 
        outputChatBox("*ERROR : This Serial Is Already Added Inside DataBase Mute Serial .",source,255,0,0,true) 
    end 
end 
) 
  

Link to comment

You're missing one column's value.

Line 24:

executeSQLQuery ( "INSERT INTO `Mute` ( PlayerSerial,Date,Name,By,Reason ) VALUES(?,?,?,?,?)",tostring(Serial),tostring(Date_Time),tostring(Name),tostring(By),tostring(Reason)) 

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