Jump to content

MTA SQL


StefanAlmighty

Recommended Posts

Okay so I've reached an issue where in my script I have the following line:

local preparedQuery3 = "INSERT INTO `accounts` (username, password, email, security_question, security_answer, last_serial, last_ip, salt) VALUES ('" .. toSQL(username) .. "', '" .. toSQL(encryptedPW) .. "', '" .. toSQL(email) .. "', 'nil', 'nil', '" .. mtaSerial .. "', '" .. toSQL(ipAddress) .. "', '" .. toSQL(encryptionRule) .. "')" 

When I click the 'register' button on my server, it gathers all the information and should create an account.

However, I have to click the 'register' button like 4+ times in order for it to create an account, even though the query runs perfectly and says the account has been created.

Link to comment
local Q3 = dbExec(mysql:connectMTA(), preparedQuery3) 
    if Q3 then 
        mysql:free_result(Q3) 
        triggerClientEvent(source, "setLoginNotice", getRootElement(), "Successfully created account " .. username .. "!", 0, 255, 0) 
        outputDebugString("DEBUG: " .. preparedQuery3) 
        return true 
    else 
        mysql:free_result(Q3) 
        triggerClientEvent(source, "setLoginNotice", getRootElement(), "Error creating account.", 255, 0, 0) 
        return false 
    end 

Doesn't work & dbExec returns false.

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