iSun
iSun

Reputation: 1754

Get response of MySql query

I have an algorithm about chat program in android, but I have a problem in server-side section.

I can store my data like username, password and e-mail through json into my database from my app but I do not know that How can I check them into my app! (e.g Get the response of username checking query into my app.)

Thanks in advance.

Upvotes: 1

Views: 840

Answers (1)

Caner
Caner

Reputation: 59198

Basically when you run httpClient.execute it will return a response, you need to use that response.

Client side:

HttpResponse resp = httpClient.execute( post );
DataInputStream is = new DataInputStream( resp.getEntity().getContent() );

Server side depends on what programming language you use. For example using python:

    self.response.headers['Content-Type'] = 'text/vnd.aexp.json.resp'
    self.response.set_status( 200,"OK" )
    self.response.out.write( json.dumps( responseList ) )  

See this example for full source code and details:

http://mylifewithandroid.blogspot.fi/2010/10/client-server-communication-with-json.html

EDIT
Check this for php server side:

http://www.happycode.info/php-json-response/

Upvotes: 1

Related Questions