Accessing data from server through php in iphone
<p>I am using this code for accessing data from server,</p>

<pre><code>NSString *post = [[NSString alloc] initWithFormat:@"Email=%@",GEmail];

 NSData *postData = [post dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES];  

 NSString *postLength = [NSString stringWithFormat:@"%d", [postData length]];  

 NSURL *url = [NSURL URLWithString:@"http://smads.in/day.php"];
 NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:url];
 [theRequest setHTTPMethod:@"POST"];  
 [theRequest setValue:postLength forHTTPHeaderField:@"Content-Length"];  
 [theRequest setHTTPBody:postData]; 


 NSURLConnection *theConnection = [[NSURLConnection alloc] initWithRequest:theRequest delegate:self];

 if( theConnection )
 {
  webData = [[NSMutableData data] retain];
 }
 else
 {

 }
</code></pre>

<p>it fetch data slightly late so problem is that--
i have a code which check fetched data from server--</p>

<pre><code>If(flag==1)

NSlog(@"YES");

else

NSlog(@"NO");
</code></pre>

<p>when i click first time then it print NO when i again click then it display yes.</p>

<p>how i check condition in one click?</p>

<p>suggest me if any idea.....</p>

<p>Thanks,</p>

<p>Arun</p>
