• Problem with SQL
    2 replies, posted
There is a problem in the gmod wiki - I fixed this once. Now I formatted pc, got old source but cant remember what the issue was. [code] function setuptable() if sql.TableExists("lat_players") then PMsg("LAT server has initialized successfully. \n") PMsg("SQL Tables set up successfully. \n") else query = "CREATE TABLE lat_players ( unique_id string, ip string, steamid string, rank string, immunity int, ban int, banreason string )" result = sql.Query(query) if (sql.TableExists("lat_players")) then PMsg("Tabes created and set up successfully. \n") else PMsg("Something went wrong with creating the tables! \n") PMsg( sql.LastError( result ) .. "\n" ) end end end function setupdatatables( ply ) setupnewp(ply) PMsg(ply:Nick() .. " joined for the first time. \n") end function setupnewp( ply ) query1 = "INSERT INTO lat_players ( unique_id, ip, steamid, rank, immunity, ban, banreason ) VALUES ( unique_id = '" .. ply:UniqueID() .. "', ip = '" .. ply:IPAddress() .. "', steamid = '" .. ply:SteamID() .. "', rank = 'guest', immunity = 0, ban = 0, banreason = 'You were permanently banned.' )" result1 = sql.Query(query1) PMsg( sql.LastError( result1 ) .. "\n" ) PMsg( sql.LastError( result ) .. "\n" ) PMsg("New player set up. \n") end [/code] no such table unique_id
[code] query1 = "INSERT INTO lat_players ( unique_id, ip, steamid, rank, immunity, ban, banreason ) VALUES ('" .. ply:UniqueID() .. "','" .. ply:IPAddress() .. "','" .. ply:SteamID() .. "', 'guest', 0, 0, 'You were permanently banned.' )" [/code] this should fix it
[QUOTE=Lizart;46601291][code] query1 = "INSERT INTO lat_players ( unique_id, ip, steamid, rank, immunity, ban, banreason ) VALUES ('" .. ply:UniqueID() .. "','" .. ply:IPAddress() .. "','" .. ply:SteamID() .. "', 'guest', 0, 0, 'You were permanently banned.' )" [/code] this should fix it[/QUOTE] I love you
Sorry, you need to Log In to post a reply to this thread.