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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T00:18:56+00:00 2026-05-24T00:18:56+00:00

the problem i am face right now is i can’t pass a variable from

  • 0

the problem i am face right now is i can’t pass a variable from iphone to php page.First i want to pass the country name to php page from iphone.

This is the php code:

$coname=$_POST["c_name"];

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

    header("Content-Type: text/xml");    
    $bilgi= mysql_query("SELECT age,wname,slid,sex FROM user WHERE user.c_name='".$coname."'");
    while($sutun= mysql_fetch_array($bilgi))
    {
        echo $sutun["age"];
        echo $sutun["wname"];
        echo $sutun["sex"];        
        echo $sutun["slid"];    
    } 

    mysql_close($con);

this is the part i ‘ve call the php page in xcode

 NSString *country=[[NSUserDefaults standardUserDefaults]objectForKey:@"namecountry"];
//url's
NSURL *url = [NSURL URLWithString:@"http://www.trevesstudios.com/get.php"];
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];

[request setPostValue:country forKey:@"c_name"];
[request setRequestMethod:@"POST"];
[request setValidatesSecureCertificate:NO];
[request setDelegate:self];
[request startSynchronous];

response = [request responseString];
NSLog(@"%@",response);

Can anyone help me for why this code is not working btw when i try to change the WHERE c_name=’France’ it works the the problem is the variable.Can anybody helpme?

  • 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-24T00:18:57+00:00Added an answer on May 24, 2026 at 12:18 am

    A few things to check:

    1. what is country value after reading it from NSUserDefaults?

    2. what does NSLog(@"%@",response); print out?

    3. in your PHP, what is $coname?

    4. is $_POST defined? is $_GET defined? could you print out $_REQUEST content (print_r($_REQUEST))?

    EDIT:

    can you put this statement

    echo print_r($_REQUEST);
    

    before $coname=$_POST["c_name"];?

    can you add this statement:

     echo mysql_errno($con) . ": " . mysql_error($con) . "\n";
    

    after executing mysql_query?

    what does it output?

    EDIT2:

    With the echoes we added above, we now know that the post parameter is arriving at the server. Are you sure that there are data stored for France in your database? mysql_error did not return any error (0: in the output), so everything went ok… it seems that the query returned no data, but it did not fail…

    Anyway, just as a further check, could you add this more statement before executing mysql_query?

    echo "SELECT age,wname,slid,sex FROM user WHERE user.c_name='".$coname."'";
    

    so we will see what the query looks like…

    EDIT3:

    please, replace:

    $coname=$_POST["c_name"];
    

    by

    $coname=$_REQUEST["c_name"];
    

    EDIT 4:

    $bilgi= mysql_query("SELECT age,wname,slid,sex,c_name FROM user");
    while($sutun= mysql_fetch_array($bilgi))
    {
        echo $sutun["age"];
        echo $sutun["wname"];
        echo $sutun["sex"];        
        echo $sutun["slid"];    
        echo $sutun["c_name"];    
    } 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My problem is certainly right on my face but I can't see it... I
I face a problem when I try to get value from primary table in
I'm facing a strange problem right now... I'm trying to use Facebook API to
I often face the problem of wanting to add additional methods to classes I
I face the following problem function book($memberid, $classid){ if (!book){ // update the db
Problem: I have an address field from an Access database which has been converted
Problem: Given a list of strings, find the substring which, if subtracted from the
now i want to drill a hole in the 3ds object i import,and if
I face following problem with three20 photobrowser app : 1: Some time images are
I have been playing around with Facial recognition in PHP via the face.com API.

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.