 |
I am register 130 fields but database taking 125 fields only other 5 fields taking 'null' value? why |
|
 |
|
|
 |
 |
|
You used encode JSON before send to php?
|
 |
 |
 |
 |
Date :
2013-08-29 06:04:51 |
By :
mr.win |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
How to use encode JSON?
I will use this method
Code (Objective-C)
- (IBAction)btnSave:(id)sender {
//sUsername=surapong&sPassword=surapong@4&sName=Surapong Siriphun&[email protected]&sTel=0812345678
NSMutableString *post = [NSString stringWithFormat:@"sUsername=%@&sPassword=%@&sName=%@&sEmail=%@&sTel=%@",
[txtUsername text],[txtPassword text],[txtName text],[txtEmail text],[txtTel text]];
NSData *postData = [post dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES];
NSString *postLength = [NSString stringWithFormat:@"%d", [postData length]];
NSURL *url = [NSURL URLWithString:@"https://www.thaicreate.com/url/registerData.php"];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url
cachePolicy:NSURLRequestReloadIgnoringLocalCacheData
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setValue:postLength forHTTPHeaderField:@"Content-Length"];
[request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
[request setHTTPBody:postData];
NSURLConnection *theConnection=[[NSURLConnection alloc] initWithRequest:request delegate:self];
// Show Progress Loading...
[UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
loading = [[UIAlertView alloc] initWithTitle:@"" message:@"Please Wait..." delegate:nil cancelButtonTitle:nil otherButtonTitles:nil];
UIActivityIndicatorView *progress= [[UIActivityIndicatorView alloc] initWithFrame:CGRectMake(125, 50, 30, 30)];
progress.activityIndicatorViewStyle = UIActivityIndicatorViewStyleWhiteLarge;
[loading addSubview:progress];
[progress startAnimating];
[progress release];
[loading show];
if (theConnection) {
self.receivedData = [[NSMutableData data] retain];
} else {
UIAlertView *connectFailMessage = [[UIAlertView alloc] initWithTitle:@"NSURLConnection " message:@"Failed in viewDidLoad" delegate: self cancelButtonTitle:@"Ok" otherButtonTitles: nil];
[connectFailMessage show];
[connectFailMessage release];
}
}
|
ประวัติการแก้ไข 2013-08-29 14:09:19
 |
 |
 |
 |
Date :
2013-08-29 14:03:58 |
By :
vishwa |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Convert all string to JSON before send to php?
iOS/iPhone and JSON (Create JSON and JSON Parsing, Objective-C)
|
 |
 |
 |
 |
Date :
2013-08-29 14:33:16 |
By :
mr.win |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Sorry. Then how to write php code?
How to insert json value?
|
 |
 |
 |
 |
Date :
2013-08-29 15:45:38 |
By :
vishwa |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
I will use this method also. Convert all string to JSON before send to php but again taking 'null'
|
 |
 |
 |
 |
Date :
2013-08-30 11:45:26 |
By :
vishwa |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|