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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T15:50:05+00:00 2026-05-12T15:50:05+00:00

My AJAX search program keeps asking PHP for results of a particular search term.

  • 0

My AJAX search program keeps asking PHP for results of a particular search term. The start of the PHP script reads thru a MySQL DB and initializes, so if the PHP keeps restarting, it will have to read the DB millions of times. If I can keep it alive and let multiple silly AJAX requests be served by a single running PHP script instance I’m sure performance would improve.

How do you do this typically? Use a service? Can this be done with services?

  • 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-12T15:50:06+00:00Added an answer on May 12, 2026 at 3:50 pm

    How about storing the db results in a session variable? You’d check first if the keyword is not in the session (sessions allow to transport variable values between page refreshes), and if not, do a db query.

    To store it:

    $_SESSION['storedQueries']['keyword']= 'its definition, from the database';
    

    To look for it:

      $index=  array_search('keyword',array_keys($_SESSION['storedQueries']));
      $result = ($index) ? $_SESSION['storedQueries'][$index] : 'nothing found, you should do a db query';
    

    The ajax part is pretty easy if you use a javascript library, such as jquery:

    $('#resultZone').load('find.php',{keyword: $('input.search').val() });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an AJAX search script I'm making and it gives results in real
I've created a program in Delphi that uses Google's AJAX Search API to evaluate
I am trying to filter/search a database with ajax $.ajax({ type: POST, url: filterSearch.php,
I'm developing the ajax search script. it's the simple code, I get javascript error.
i'm calling the search.php page via ajax to search.html. the problem is, since i've
Hi I have a simple ajax search that returns the results in a table.
I am creating a jQuery / AJAX search script, and I am trying to
I am writing a Python program that feeds a search term to google using
O, so i have a 'live search' ajax search, which currently runs an sql
Hey there, new to AJAX, JS.. Im trying to add to a Javascript/Ajax search

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.