Page 1 of 1

SQL Statement

Posted: Mon Jun 24, 2019 2:27 am
by Quinton B.
No data seems to be inserted into the database, whats wrong?

Code: Select all

put the text of graphic "The_Image" into tImageCheck
   put "tImageCheck, tUserNameCheck, tPasswordCheck, tDoDEmailCheck, tDSNCheck, tPersonellNumberCheck, tAddressCheck, tSecurityQuestion1, tSecurityAnswer1, tSecurityQuestion2, tSecurityAnswer2, tSecurityQuestion3, tSecurityAnswer3, tBranchCheck, tBaseCheck, tOperationsGroupCheck, tSquadronCheck, tFlightCheck, tRankCheck, tRandomAlphaNumericalGenerator" into tALLFIELDS
   --put tImageCheck, tUserNameCheck, tPasswordCheck, tDoDEmailCheck, tDSNCheck, tPersonellNumberCheck, tAddressCheck, tSecurityQuestion1, tSecurityAnswer1, tSecurityQuestion2, tSecurityAnswer2, tSecurityQuestion3, tSecurityAnswer3, tBranchCheck, tBaseCheck, tOperationsGroupCheck, tSquadronCheck, tFlightCheck, tRankCheck, tRandomAlphaNumericalGenerator into tALLFIELDS
   put "xxx" into tBA
   put "xxx" into tDBN
   put "xxx" 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)" 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"
      if item 1 of tData = "revdberr" then
         answer error "There was a problem querying the database:" & cr & tData
      else
         RegisterResetCard
         SendTheEmail
         go to card "Login"
      end if
   end if
   revCloseDatabase gConnectionID
end ClearAndVerify

Re: SQL Statement

Posted: Mon Jun 24, 2019 7:54 am
by SparkOut
First question, are the database column names really the same as the variable names? I mean in the database structure do you really have columns called 'tUserNameCheck' and 'tImageCheck'?

Re: SQL Statement

Posted: Mon Jun 24, 2019 6:34 pm
by Quinton B.
No, lol, I think you might have helped me, but from which portion should the database coulmn names be after put the text of graphic etc, etc. Or at the revExecuteSQL line.

Re: SQL Statement

Posted: Mon Jun 24, 2019 9:40 pm
by SparkOut
In the second line of the code example above put the real database column names into tALLFIELDS

Then we can see what else nweds to be addressed

Re: SQL Statement

Posted: Tue Jun 25, 2019 7:38 am
by bangkok
It's becoming a real trend.

All newbies got lost with the "variablesList" and "arrayName" forms, for revExecuteSQL and revQueryDatabase commands (look in the forum...)

Just don't do it !

Use the classic form, which you can read, which you can "see".

If you can not "see" (read) a SQL statement, then you're blind. And then you make mistakes. Inevitably.

The "classic" form is :

Code: Select all

put "Hello World" into tMyVar
put "update mytable set myvar='"&tMyVar&&"' where myindex=1" into tSQL
answer tSQL
revExecuteSQL gConnectionID, tSQL