Lloyd Logan Posted January 11, 2014 Posted January 11, 2014 Why is this creating an account row and password row, but its putting in blank values e.g. accounts || Password both just equal blank! CLIENT function checkRegField() local inputusernamereg = guiGetText(GUIEditor.edituserreg) local inputpasswordreg = guiGetText(GUIEditor.editpassreg) triggerServerEvent("submitRegister", localPlayer, inputusernamereg, inputpasswordreg) end SERVER function submitReg() dbExec(server, "CREATE TABLE IF NOT EXISTS accounts (accountname TEXT NOT NULL, password TEXT NOT NULL)") new = dbExec(server, "INSERT INTO accounts (accountname, password) VALUES (?,?)", inputusernamereg, inputpasswordreg) output = outputChatBox("You have successfully created an account!") triggerClientEvent("closedok", getRootElement()) triggerClientEvent("onclose", getRootElement()) end
InFerNo_01 Posted January 11, 2014 Posted January 11, 2014 function submitReg() dbExec(server, "CREATE TABLE IF NOT EXISTS accounts (accountname TEXT NOT NULL, password TEXT NOT NULL)") new = dbExec(server, "INSERT INTO accounts (accountname, password) VALUES ('"..inputusernamereg.."','"..inputpasswordreg.."')") output = outputChatBox("You have successfully created an account!") triggerClientEvent("closedok", getRootElement()) triggerClientEvent("onclose", getRootElement()) end
xXMADEXx Posted January 11, 2014 Posted January 11, 2014 Try this: dbExec(server, "CREATE TABLE IF NOT EXISTS accounts (accountname TEXT, password TEXT)") function submitReg( inputusernamereg, inputpasswordreg ) dbExec(server, "INSERT INTO accounts (accountname, password) VALUES (?,?)", tostring ( inputusernamereg ), tostring ( inputpasswordreg ) ) outputChatBox("You have successfully created an account!", source) triggerClientEvent(source, "closedok", source ) triggerClientEvent(source, "onclose", source ) end If it doesn't work, post your database connection. function submitReg() dbExec(server, "CREATE TABLE IF NOT EXISTS accounts (accountname TEXT NOT NULL, password TEXT NOT NULL)") new = dbExec(server, "INSERT INTO accounts (accountname, password) VALUES ('"..inputusernamereg.."','"..inputpasswordreg.."')") output = outputChatBox("You have successfully created an account!") triggerClientEvent("closedok", getRootElement()) triggerClientEvent("onclose", getRootElement()) end When you're using database functions, it's better to use "VALUES ( ?, ?, ... )"
Lloyd Logan Posted January 11, 2014 Author Posted January 11, 2014 Thanks guys, I'll try both when I'm free and get back to you all!
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now