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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T17:46:16+00:00 2026-05-30T17:46:16+00:00

I am making consecutive http get request to a PHP file on my server.

  • 0

I am making consecutive http get request to a PHP file on my server. The PHP is very simple and is as follows:

$con = mysql_connect('bla', 'bla', 'bla');
// retrieve required info from database
mysql_close($con);
echo $result;

These lines are from android code which sends get requests:

DefaultHttpClient client = new DefaultHttpClient();
HttpGet getRequest = new HttpGet(url);
HttpResponse getResponse = client.execute(getRequest);

At first glance, it seems that sql connection is opened and closed for each call on server side. This is not efficient since same client sends consecutive requests. So I want to keep connection open for same client until it stops sending get requests. Is this done automatically apachi/php/whatever or should I do something manually? There are similar questions but I just want to ask for my specific example. Since my objective is to listen a server, any recommendation (like a more efficient comet technique) is also welcomed…

  • 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-30T17:46:17+00:00Added an answer on May 30, 2026 at 5:46 pm

    Use mysql_pconnect

    $con = mysql_pconnect('bla', 'bla', 'bla');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am making some consecutives(recrusive) ajax request to a php file that writes request
making a simple movie review site to practice PHP. on one page ( a
Im making a simple poker script in PHP and up to the point where
Making a GET request is easy, you just specify an URL in the href
Making a search result list (like in Google) is not very hard, if you
Making a simple program which will generate a multiple choice form. I have an
Making my PHP Command line application support Linux and Windows. Currently it has this
Making an app where we want to send a photo to a server along
im making a server for an application, and I made a thread for accepting
After consecutive builds of a solution without making any changes to an assembly's code

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.