title: From ios with PHP to mySQL
body: <p>I got a working code on getting the location.</p>
  
  <p>I want to store the values from a textfield(i just leave it NULL for now), my longitude, latitude and timestamp.</p>
  
  <p>This is the code where i send it to my php file</p>
  
  <pre><code>NSString *latitude =  [NSString stringWithFormat:@"%f", newLocation.coordinate.latitude];
  NSString *longitude =  [NSString stringWithFormat:@"%f",   newLocation.coordinate.longitude];
  NSString *stringFromDate = [formatter stringFromDate:newLocation.timestamp];
  
  
  NSMutableURLRequest *request =
  [[NSMutableURLRequest alloc] initWithURL:
  [NSURL URLWithString:@"http://www.yourdomain.com/locatie.php"]];
  
  [request setHTTPMethod:@"POST"];
  
  NSString* postString = [NSString stringWithFormat:@"%@ %@ %@", latitude, longitude,   stringFromDate];    
  [request setValue:[NSString
                     stringWithFormat:@"%d", [postString length]] forHTTPHeaderField:@"Content-length"];
  
  [request setHTTPBody:[postString
                        dataUsingEncoding:NSUTF8StringEncoding]];
  
  [[NSURLConnection alloc] initWithRequest:request delegate:self];
  </code></pre>
  
  <p>And here's my code in my PHP File.</p>
  
  <pre><code>&lt;?php
  // Connecting, selecting database
  
  $id = $POST['id'];
  $longitude = $POST['longitude'];
  $latitude = $POST['latitude'];
  $timestamp = $POST['stringFromDate'];
  
  
  
  $link = mysql_connect('server', 'name', 'pass')
      or die('Could not connect: ' . mysql_error());
  
  mysql_select_db('db_name') or die('Could not select database');
  
  // Performing SQL query
  $query("INSERT INTO locatie (id, longitude, latitude, timestamp)
          VALUES (NULL, $longitude,$latitude,$timestamp )");
  $result = mysql_query($query) or die('Query failed: ' . mysql_error());
  
  echo "OK";
  
  // Free resultset
  mysql_free_result($result);
  
  // Closing connection
  mysql_close($link);
  ?&gt;
  </code></pre>
  
  <p>What am i doing wrong?
  All the help is appreciated. </p>
  
  <p>Thanks</p>
  
  <p><strong>PS: I don't get any errors, the only thing is that my database stays empty</strong></p>
  
  <p><strong>It's still not working, please if anybody knows what i'm doing wrong</strong></p>