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

  • SEARCH
  • Home
  • 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 7091105
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T08:08:29+00:00 2026-05-28T08:08:29+00:00

My iPhone app communicates through a php file with my mySql database. Everything works

  • 0

My iPhone app communicates through a php file with my mySql database. Everything works fine. But when I send the form and the username already exists, the php file should somehow backfire a notification. What should I do ?

php File

$query = "SELECT username FROM userData WHERE username = '$username'";  
    $result = mysql_query($query);  
    if (mysql_num_rows($result) > 0) { 
    // WHAT SHOULD BE DONE HERE TO NOTIFY iPHONE ? 
    }

I could think of a way, but it I think there is a better and more efficient way to do it.

[EDIT]

This is what I did to get the response:

 NSURLResponse *theResponse =[[NSURLResponse alloc]init];
        NSError *error;
        NSData *data = [NSURLConnection sendSynchronousRequest:request returningResponse:&theResponse error:&error];      

         NSDictionary *jsonDictionaryResponse =[NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:&error];
        NSLog(@"json response = %@", jsonDictionaryResponse);

[/EDIT]

  • 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-28T08:08:30+00:00Added an answer on May 28, 2026 at 8:08 am

    He does not really need a push notification. Just need a response back from the server.

    $query = "SELECT username FROM userData WHERE username = '$username'";  
    $result = mysql_query($query);  
    if (mysql_num_rows($result) > 0) { 
    // WHAT SHOULD BE DONE HERE TO NOTIFY iPHONE ? 
    sendResponse(200, json_encode('SUCCESS Notification'));
    }
    

    Where sendResponse looks like this

    // Helper method to send a HTTP response code/message

    function sendResponse($status = 200, $body = '', $content_type = 'text/html')
    {
        $status_header = 'HTTP/1.1 ' . $status . ' ' . 'OK';
        header($status_header);
        header('Content-type: ' . $content_type);
        echo $body;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My iPhone app communicates with a php script hosted on a server. Hard coded
I'm writing an application for the iPhone that communicates with a SQLite database but
I currently have an iPhone app that communicates with a C++ server running on
I'm working on a largely navigation-based iPhone app that communicates with a REST API
I am developing an iphone app that uses a php web service for all
We have a Rails app which communicates with a PhoneGap-based iPhone app. We are
My iPhone app is grabbing a JSON object from a PHP website. The object
I am working on an iPhone App which communicates with a Server to store
I've made an IPhone App that communicates to a service by calling a webservice
My iPhone app communicates with a RESTful service that provides JSON output. I've been

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.