Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6149919
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T19:32:05+00:00 2026-05-23T19:32:05+00:00

I POST a variable section from my iphone app to a php web service.

  • 0

I POST a variable “section” from my iphone app to a php web service. This web checks to see if section isset before interrogating the database for data retrieval..

I use the following method to post data:

+(void)getQuestions:(NSInteger)sectionId from: (NSString*) url{
    //connect to database given by url
    NSMutableString* myRequestString = [[NSMutableString string]initWithFormat:@"section=%@", sectionId];
    NSData *myRequestData = [NSData dataWithBytes: [myRequestString UTF8String] length: [myRequestString length]];
    NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL: [NSURL URLWithString: url]]; 
    [request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"content-type"];
    [request setHTTPMethod: @"POST"];
    //post section 
    [request setHTTPBody: myRequestData];
} 

Within the same method I would like to capture the array echoed by the php file:

<?php

//connect to database
function connect() {
  $dbh = mysql_connect ("localhost", "abc", "defgo") or die ('I cannot connect to the database because: ' . mysql_error());
  mysql_select_db("PDS", $dbh); 
  return $dbh;
}

//store posted data
if(isset($_POST['section'])){
  $dbh = connect();
  $section = $_POST['section'];
  $query = mysql_query("SELECT * FROM QUESTIONS WHERE sectionId = $section;") or die("Error: " . mysql_error());;

  $rows = array();
  while($r = mysql_fetch_assoc($query)) {
    $rows[] = $r;
  }      
  echo $rows;
  mysql_close();
}
?>

What part of the objective C API allows you to capture response data? How can I modify the above objective c function to store the $rows variable?

The $rows variable is an associative array storing tuples from a database..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T19:32:06+00:00Added an answer on May 23, 2026 at 7:32 pm

    I answered this in your other question, but I’ll answer it here as well. You can use NSURLConnectionDelegate to capture the response, and also alert you of any problems.

    Take a look at the URL Loading System Programming Guide – it’s quite comprehensive in its examples.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

hello frieds this is how i usually post a variable using Jquery.. $.post(include/save_legatee.inc.php, {
i want to generate HMAC-SHA1 of NSString type variable. I see the post but
When my PHP script receives data from an AJAX POST request, the $_POST variables
Having a little bit of trouble with this section of code: if(!empty($_POST['RemoveRequest']) && isset($_POST['RemoveRequest'])){
I need to pre-load some values from a php script, I'm using a $.post
Please review this Stackoverflow post. I have the same PHP problem as bob_cobb. Here's
I pass text from a POST variable from a form on my site to
I'm currently building a web-app that has one section where the user sees a
I'm trying to post a variable to my php handler page, that tells php
Is there any way to do some kind of while() for each post variable

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.