Jump to content

Please db for this


ReGo

Recommended Posts

Posted
        -- new clothing stuff 
                values.id = exports.mysql:query_insert_free("INSERT INTO clothing (skin, url, description, price) VALUES (" .. tonumber(values.skin) .. ", '" .. exports.mysql:escape_string(values.url) .. "', '" .. exports.mysql:escape_string(values.description) .. "', " .. tonumber(values.price) .. ")") 
                if values.id then 
                    savedClothing[values.id] = values 
                    outputChatBox('Drēbes pievienotas ar ID ' .. values.id .. '.', client, 0, 255, 0) 
                else 
                    outputChatBox('Neizdevās pievienot drēbes.', client, 255, 0, 0) 
                end 
            else 
                -- old clothing stuff 
                local existing = savedClothing[values.id] 
                if existing then 
                    if exports.mysql:query_free('UPDATE clothing SET skin = ' .. tonumber(values.skin) .. ', description = "' .. exports.mysql:escape_string(values.description) .. '", price = ' .. tonumber(values.price) .. ' WHERE id = ' .. tonumber(values.id)) then 
                        outputChatBox('Apģērbs saglabats.', client, 0, 255, 0) 
  
                        existing.skin = tonumber(values.skin) 
                        existing.description = tostring(values.description) 
                        existing.price = tonumber(values.price) 
                    else 
                        outputChatBox('Apģērbs netika saglabāts.', client, 255, 0, 0) 
                    end 
                else 
                    outputChatBox('Neizdevās atrast apģērbus.', client, 255, 0, 0) 
                end 
            end 
        end 
    end, false) 

Posted

By the title I guess you took the script from somewhere as you don't have database and you are trying to handle database functions. Correct me if I am wrong.

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