Insert value to db based on a condition using Javascript -


i'm developing small quiz saves participants information db , based on quiz results save status has 0 not answering correctly , 1 correct answers. think made mistakes somewhere, , i'm new javascript , need advice. here code inserting database:

function setuserinfofunction(email, firstname, lastname,company ,phone, status) {         var result = wl.server.invokesqlstatement({             preparedstatement: setuserinfo, parameters : [email,firstname, lastname, company,phone, status]         });         return result;   

};

here code part supposed validate result of quiz , give user status:

function validation(){  if (answers[0]==choices[0][0]  &&  answers[1]==choices[1][1]  &&  answers[2]==choices[2][2] && answers[2] == choices[2][1] ) {       setuserinfo = parameters (status = '1');     }  else {     setuserinfo = parameters (status = '0'); } } if (answers[0]==choices[0][0]  ||  answers[1]==choices[1][1]  ||  answers[2]==choices[2][2] || answers[2] == choices[2][1]) {       setuserinfo = parameters (status = '0');  } else {     setuserinfo = parameters (status = '1'); } 


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -