IOS unable to insert data in to mysql database -
hello trying insert user data in myaql database using json. unable so, data not inserting , getting no error. following code.
objective c code
{ nsstring *post =[nsstring stringwithformat:@"name=%@&email=%@&password= %@&phone=%@",self.name.text, self.pass.text,self.phone.text,self.email.text]; nsdata *data = [post datausingencoding:nsutf8stringencoding]; nsurl *url = [nsurl urlwithstring:@"http://my url"]; nsmutableurlrequest *request = [nsmutableurlrequest requestwithurl:url]; [request sethttpmethod:@"post"]; [request sethttpbody:data]; nsurlresponse *response; nserror *err; nsdata *responsedata = [nsurlconnection sendsynchronousrequest:request returningresponse:&response error:&err]; nslog(@"responsedata: %@", responsedata); }
i using code insert textfields data mysql database.it seems no error data not inserting in database. in advance.
seems ios implementation correct, server side not. try following: in server-side script, mysql insert-statement being generated,
echo $insertscript;
and run app again , see response says. should return valid mysql insert script. copy , run on server's mysql instance , see happens
also, remove spaces in password field
Comments
Post a Comment