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 6170449
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T23:02:15+00:00 2026-05-23T23:02:15+00:00

My problem is that I don’t know how to send the data that I

  • 0

My problem is that I don’t know how to send the data that I find (with Select From Where) in PHP to Objective-C. I know I need to make a dataset but how do I do it? Some people say I should use JSON but I can’t find any solution. Indeed, I don’t know how to make a response in PHP? Can anyone help me?

This is my PHP code:

$con = mysql_connect("url","username","password");

if (!$con){die('Could not connect: ' . mysql_error());}
    mysql_select_db("Appiness", $con);

$bilgi= mysql_query("SELECT c_id FROM country WHERE c_name='$country'");

while($sutun= mysql_fetch_array($bilgi))
{
    echo $sutun["c_id"];
}

mysql_close($con);

This is my Objective-C code:

NSURL *url = [NSURL URLWithString:@"someurl"];
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];

[request setPostValue:year1 forKey:@"year"];
[request setPostValue:appy_level forKey:@"appy_level"];
[request setPostValue:reasons forKey:@"reasons"];
[request setPostValue:country forKey:@"country"];
[request setPostValue:city forKey:@"city"];
[request setPostValue:sex forKey:@"sex"];
[request setRequestMethod:@"POST"];
[request setValidatesSecureCertificate:NO];
[request setDelegate:self];
[request setDidFinishSelector:@selector(requestDone:)];
[request startAsynchronous];

- (void)requestDone:(ASIHTTPRequest *)request
{
    NSString *response = [request responseString];
    NSLog(@"%@",response);
}

- (void)requestFailed:(ASIHTTPRequest *)request
{    

    NSError *error = [request error];
    NSLog(@"%@",[error localizedDescription]);
}
  • 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-23T23:02:17+00:00Added an answer on May 23, 2026 at 11:02 pm

    Assuming you know xml parsing you can response with xml as follows using php code.

    <?php
        include_once('config.php');
        header("Content-Type: text/xml");
        $error_respond ='<?xml version="1.0" encoding="utf-8"?><result>failure</result>';
        if($_SERVER['REQUEST_METHOD'] == 'POST')
        {
            $return_val='<?xml version="1.0" encoding="utf-8"?>';
            $id = $_POST['userid'];
            $return_val=$return_val.'<UserDetails>';
    
            $selusersql ="select * from users where userid = ".$id;
            $selusertrs  = mysql_query($selusersql);
            $selusernum = mysql_num_rows($selusertrs);
            while($userrow = mysql_fetch_array($selusertrs))
            {
                $return_val=$return_val.'<UserID>'.$userrow['User_ID'].'</UserID>';
                $return_val=$return_val.'<UserName>'.$userrow['User_Name'].'</UserName>';
                $return_val=$return_val.'<Email>'.xmlentities($userrow['User_Email']).'</Email>';
            }
            $return_val=$return_val.'</UserDetails>';
            echo $return_val;
        }
        else
        {
            echo $error_respond;
            exit;
        }
    ?>
    

    Sample Output of above code will be (assuming user id posted 1 and details stored in db is as follows)

    <?xml version="1.0" encoding="utf-8"?>
    <UserDetails>
    <UserID>1</UserID>
    <UserName>DummyUser</UserName>
    <Email>Dummy@Dummy.com</Email>
    </UserDetails>
    

    if error occurred like someone tried to call your url from browser directly i.e. request method is not POST so we will return following response showing error. (I believe post is better than get).

    <?xml version="1.0" encoding="utf-8"?>
    <result>failure</result>
    

    Now last important part is you have to parse this response according to your requirement. Search around and you will get xmlparsing demo like how to do xml parsing in iphone.

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

Sidebar

Related Questions

So I have a problem that I don't really know how to go about.
i have a problem, that i don't know how to solve it. i have
I have a problem that I don't know how to solve. I have have
I'm facing a recurrent problem that I don't know why it is happening. It
Quick question, I have a simple javascript problem that I don't know the fix
I got a problem that I don't know how to fix it. Please help!
I'm facing a problem that I don't know how to solve and am hoping
There is a problem that don't know how to resolve only with SQL (I
I have come across a problem that I don't know how to resolve involving
I have a small problem that I don't know how to deal with. I've

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.