Data is not inserting into the table.... :(

You must Login before you can answer or comment on any questions.

Hi, My database is now connected properly but when i was trying to insert the data into the database its not getting stored in the database.. Many thanks in advance.

Code for storing data: while(rows.isValidRow()){ var this_rid= rows.fieldByName('Regid'); var this_nm= rows.fieldByName('Name'); var this_phno= rows.fieldByName('Phno'); var this_add= rows.fieldByName('Address'); var this_st= rows.fieldByName('State'); var this_ci= rows.fieldByName('City'); var this_tk= rows.fieldByName('Taluka'); var this_pc= rows.fieldByName('Pincode');

Ti.API.info(this_rid+ ' ' + this_nm+ ' ' + this_phno+ ' ' + this_add+ ' ' +this_st+ ' ' + this_ci+ ' ' + this_tk+ ' ' + this_pc);

rows.next(); } rows.close();

aButton.addEventListener('click', function (){ if (tfrid.value != '' && tfname.value != '' && tfphno.value != '' && tfadd.value != '' && tfstate.value != '' && tfcity.value != '' && tftaluka.value != '' && tfpcode.value != '') { var dbData = { Regid: tfrid.value, Name: tfname.value, Phno: tfphno.value, Address: tfadd.value, State: tfstate.value, City: tfcity.value, Taluka: tftaluka.value, Pincode: tfpcode.value }; var insertdata="INSERT INTO kisan (Regid,Name,Phno,Address,State,City,Taluka,Pincode)VALUES('"+tfrid.value+"','"+tfname.value+"','"+tfphno.value+"','"+tfadd.value+"','"+tfstate.value+"','"+tfcity.value+"','"+tftaluka.value+"','"+tfpcode.value+"')"; //var insertdata="INSERT INTO kisan (Regid,Name,Phno,Address,State,City,Taluka,Pincode)VALUES('"+Regid+"','"+Name+"','"+Phno+"', '"+Address+"', '"+State+"','"+City+"','"+Taluka+"','"+Pincode+"')"; var insertqry= db.execute(insertdata); alert("Thank you for Registered"); } else { alert("Please fill in all fields"); };

})

2 Answers

hi pratik sorry to say but your code is very clos-close and looking messy so please i suggest you to use pastie.org and paste your code there and give that link here so that people can understand your code. or what you can do is just type ~~~ then your code in next line and then again in next line after your code type ~~~ and the poste your code

Your Answer

Think you can help? Login to answer this question!