I am trying to do a new user registration in my system using an XBasic function. Below is what I have, with CheckUser I am trying to see if an email already exists in the database table and if it doesnt then insert that user. Then with Continue, I want to lookup the newly inserted user's id based on the email and insert some information in other tables including that id which ties the tables records back to that user. The insert user seems to be working but from where 'if Continue == 1' down it doesnt seem to work. Not sure what the issue is here. Also, if there is a better way to do new registration then I open to do it that way too.
dim globalcn as sql::connection
dim sql as c
dim args as sql::arguments
dim flag as l
dim sqlCommand as c
dim NewUserValue as n
dim CheckUser as c
dim Continue as n
flag = globalcn.open("::name::conn")
args.set("currentuser", e.dataSubmitted.USERNAME1)
args.set("currentdate", date())
CheckUser = sql_lookup("::name::conn", "pvv_o", "EMAIL = :currentuser","email",args)
if CheckUser == ""
flag = globalcn.execute("INSERT INTO pvv_o(email, profile_create_date, last_login, status) VALUES (:currentuser, :currentdate, :currentdate, '1')",args)
Continue = 1
end if
if Continue == 1
NewUserValue = sql_lookup("::name::conn", "pvv_o", "EMAIL = :currentuser","id",args)
flag = globalcn.execute("INSERT INTO pvv_info (id, full_name, status) VALUES (:NewUserValue, 'NEED INFO', '1')"
flag = globalcn.execute("INSERT INTO pvv_l (id, l, status) VALUES (:NewUserValue, 'NO', '1')",args)
flag = globalcn.execute("INSERT INTO pvv_v (id, status) VALUES (:NewUserValue, '1')",args)
end if
dim globalcn as sql::connection
dim sql as c
dim args as sql::arguments
dim flag as l
dim sqlCommand as c
dim NewUserValue as n
dim CheckUser as c
dim Continue as n
flag = globalcn.open("::name::conn")
args.set("currentuser", e.dataSubmitted.USERNAME1)
args.set("currentdate", date())
CheckUser = sql_lookup("::name::conn", "pvv_o", "EMAIL = :currentuser","email",args)
if CheckUser == ""
flag = globalcn.execute("INSERT INTO pvv_o(email, profile_create_date, last_login, status) VALUES (:currentuser, :currentdate, :currentdate, '1')",args)
Continue = 1
end if
if Continue == 1
NewUserValue = sql_lookup("::name::conn", "pvv_o", "EMAIL = :currentuser","id",args)
flag = globalcn.execute("INSERT INTO pvv_info (id, full_name, status) VALUES (:NewUserValue, 'NEED INFO', '1')"
flag = globalcn.execute("INSERT INTO pvv_l (id, l, status) VALUES (:NewUserValue, 'NO', '1')",args)
flag = globalcn.execute("INSERT INTO pvv_v (id, status) VALUES (:NewUserValue, '1')",args)
end if
Comment