title: Connecting through webservice
body: <p>Im trying to insert into a database on a webserver. Im using MYSQL,Appache and PHP</p>
  
  <p>Xcode</p>
  
  <pre><code>*-(IBAction)saveRecord:(id)sender{
      UITextField *description_txtfield = (UITextField*)[self.tableView viewWithTag:11];
      description_string = description_txtfield.text;
      NSLog(description_string);
  
      NSURL *url = [NSURL URLWithString:@"http://192.168.1.140/~admin/qw/"];
      ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
      [request setPostValue:description_string forKey:@"product_name"];
      [request setDelegate:self];
      [request startAsynchronous];
  
      [self.navigationController popToRootViewControllerAnimated:YES];
  }
  - (void)requestFinished:(ASIHTTPRequest *)request {    
  
      if (request.responseStatusCode == 400) {
          NSLog(@"Invalid code");        
      } else if (request.responseStatusCode == 403) {
          NSLog(@"Code already used");
      } else if (request.responseStatusCode == 200) {
          NSLog(@"OK");
  
      } else {
          NSLog(@"Unexpected error");
      }
       }*
  
  - (void)requestFailed:(ASIHTTPRequest *)request
  {    
      NSError *error = [request error];
      NSLog(error.localizedDescription);
  }   
  index.php has the following code inside to handle insert.
  
  Function redeem() {
  
          // Check for required parameters
          if (isset($_POST["product_name"])) {
  
              // Put parameters into local variables
              $rw_app_id = $_POST["product_name"];
              // Add tracking of redemption
              $stmt = $this-&gt;db-&gt;prepare("INSERT INTO inventory (product_name) VALUES (?)");
              $stmt-&gt;bind_param($rw_app_id);
              $stmt-&gt;execute();
              $stmt-&gt;close();
  
          }
          return false;
  
      }
  </code></pre>
  
  <p>Can someone tell me what im doing wrong here. I keep getting Invalid Code which is Bad Request-400. Help! this is driving me nuts!</p>