Page 1 of 1
MY SQL Insert
Posted: Sun May 12, 2019 12:37 pm
by Quinton B.
Hello, i've tried different variations of inserting data into my sql database without luck, whats wrong with it?
Code: Select all
put "INSERT INTO PAV2_ACCOUNTS (" & tALLFIELDS & ") VALUES (:1, :2, :3, :4, :5, :6, :7, :8, :9, :10, :11, :12, :13, :14, :15, :16, :17, :18, :19, :20)" into lSQL
-------------------------------
--THE BELLOW LINE COULD FUCK UP
-------------------------------
revExecuteSQL gConnectionID, lSQL, "tImageCheck", "tUserNameCheck", "tPasswordCheck", "tDoDEmailCheck", "tDSNCheck", "tPersonellNumberCheck", "tAddressCheck", "tSecurityQuestion1", "tSecurityAnswer1", "tSecurityQuestion2", "tSecurityAnswer2", "tSecurityQuestion3", "tSecurityAnswer3", "tBranchCheck", "tBaseCheck", "tOperationsGroupCheck", "tSquadronCheck", "tFlightCheck", "tRankCheck", "tRandomAlphaNumericalGenerator"
Re: MY SQL Insert
Posted: Sun May 12, 2019 12:47 pm
by Klaus
Hi Quinton,
please show us the content of tALLFIELDS.
Best
Klaus
Re: MY SQL Insert
Posted: Sun May 12, 2019 12:59 pm
by Quinton B.
Code: Select all
put tImageCheck, tUserNameCheck, tPasswordCheck, tDoDEmailCheck, tDSNCheck, tPersonellNumberCheck, tAddressCheck, tSecurityQuestion1, tSecurityAnswer1, tSecurityQuestion2, tSecurityAnswer2, tSecurityQuestion3, tSecurityAnswer3, tBranchCheck, tBaseCheck, tOperationsGroupCheck, tSquadronCheck, tFlightCheck, tRankCheck, tRandomAlphaNumericalGenerator into tALLFIELDS
Re: MY SQL Insert
Posted: Sun May 12, 2019 1:06 pm
by Klaus
Does it works with QUOTES?
Code: Select all
...
put "tImageCheck, tUserNameCheck, tPasswordCheck, tDoDEmailCheck, tDSNCheck, tPersonellNumberCheck, tAddressCheck, tSecurityQuestion1, tSecurityAnswer1, tSecurityQuestion2, tSecurityAnswer2, tSecurityQuestion3, tSecurityAnswer3, tBranchCheck, tBaseCheck, tOperationsGroupCheck, tSquadronCheck, tFlightCheck, tRankCheck, tRandomAlphaNumericalGenerator" into tALLFIELDS
...
Re: MY SQL Insert
Posted: Sun May 12, 2019 1:14 pm
by Klaus
Are these names of variables or the name of the database fields?
Re: MY SQL Insert
Posted: Mon May 13, 2019 12:58 am
by bangkok
If you look at past posts, it's obvious : this syntax (variable list and array) create many problems for newbies.
It's important to go step by step.
Start with the
SIMPLE SYNTAX, aka "
i execute a query that i can read"
Therefore :
Code: Select all
put "INSERT INTO PAV2_ACCOUNTS (column1,column2,column3) VALUES ('"&tImageCheck&"','"&tUserNameCheck&"','"&tPasswordCheck&"')" into lSQL
answer lSQL
revExecuteSQL gConnectionID, lSQL
put the Result into tResult
answer tResult
VoilĂ :
-it's quare
-you have control
-you can "read" the full SQL query, and therefore you can spot any error or syntax problem

Re: MY SQL Insert
Posted: Mon May 13, 2019 12:55 pm
by Quinton B.
I'm still having problems with it:
The x are to not display the actual data im putting into the database, this is just to allow me to validate many other things on the app.
Code: Select all
on mouseup
put "123" into tImageCheck
put "xxx" into tUserNameCheck
put "xxx!!" into tPasswordCheck
put "xxxx.mil" into tDoDEmailCheck
put "xx" into tDSNCheck
put "xxx" into tPersonellNumberCheck
put "What was your favorite sport in high school?" into tSecurityQuestion1
put "xxx" into tSecurityAnswer1
put "What is your favorite movie?" into tSecurityQuestion2
put "xxxx" into tSecurityAnswer2
put "What was the name of the company where you had your first job?" into tSecurityQuestion3
put "xxx" into tSecurityAnswer3
put "xxx" into tBranchCheck
put "xxx" into tBaseCheck
put "xxxx" into tOperationsGroupCheck
put "xxxx" into tSquadronCheck
put "xxxxx" into tFlightCheck
put "xxx" into tRankCheck
put "tImageCheck, tUserNameCheck, tPasswordCheck, tDoDEmailCheck, tDSNCheck, tPersonellNumberCheck, tAddressCheck, tSecurityQuestion1, tSecurityAnswer1, tSecurityQuestion2, tSecurityAnswer2, tSecurityQuestion3, tSecurityAnswer3, tBranchCheck, tBaseCheck, tOperationsGroupCheck, tSquadronCheck, tFlightCheck, tRankCheck" into tALLFIELDS
put "xxxx" into tBA
put "xxxx" into tDBN
put "xxxx" into tDBU
put "xxx" into tDBP
put revOpenDatabase("mysql", tBA, tDBN, tDBU, tDBP) into lLogin
put lLogin into gConnectionID
if lLogin is a number then
put "INSERT INTO PAV2_ACCOUNTS (" & tALLFIELDS & ") VALUES (:1, :2, :3, :4, :5, :6, :7, :8, :9, :10, :11, :12, :13, :14, :15, :16, :17, :18, :19, :20, :21, :22, :23)" into lSQL
---------------------------
--THE BELLOW LINE COULD FUCK UP
---------------------------
revExecuteSQL gConnectionID, lSQL, "tImageCheck", "tUserNameCheck", "tPasswordCheck", "tDoDEmailCheck", "tDSNCheck", "tPersonellNumberCheck", "tAddressCheck", "tSecurityQuestion1", "tSecurityAnswer1", "tSecurityQuestion2", "tSecurityAnswer2", "tSecurityQuestion3", "tSecurityAnswer3", "tBranchCheck", "tBaseCheck", "tOperationsGroupCheck", "tSquadronCheck", "tFlightCheck", "tRankCheck"
if item 1 of tData = "revdberr" then
answer error "There was a problem querying the database:" & cr & tData
else
answer "Data Added"
revCloseDatabase gConnectionID
end if
end if
end mouseup
Re: MY SQL Insert
Posted: Mon May 13, 2019 1:30 pm
by Klaus
Hi Quinton,
as I wrote:
Are these names of variables or the name of the database fields?
Now I see these are the names of your variables.
Question is, are these ALSO the names of your database fields?
I doubt, however you treat them like they are.
Best
Klaus
Re: MY SQL Insert
Posted: Mon May 13, 2019 5:09 pm
by Quinton B.
All the variables have the letter t before them, while all others are the actual database columns.
Re: MY SQL Insert
Posted: Mon May 13, 2019 5:18 pm
by Klaus
Sure?
Code: Select all
...
put "123" into tImageCheck
...
put "tImageCheck, tUserNameCheck,..." into tALLFIELDS
...
