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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:23:42+00:00 2026-05-28T05:23:42+00:00

Basically I have a search query, which works fine if I’m using it with

  • 0

Basically I have a search query, which works fine if I’m using it with $_GET, but I want to use $_POST for one of them (then return with json). However I’m unsure how to accomplish this so that the search will look at each word individually…

Here’s my search query…

    SELECT  DISTINCT(auto), user_id, username, first_name, last_name, email, sex, active, ppic, time_zone, adult_filter, ((CASE WHEN `username` LIKE '%$search%' THEN 2 ELSE 0 END) + (CASE WHEN `first_name` LIKE '%$search%' THEN 1 ELSE 0 END) + (CASE WHEN `last_name` LIKE '%$search%' THEN 1 ELSE 0 END)) AS relevance
FROM users, network
WHERE `username` LIKE '%$search%' OR
  `last_name`LIKE '%$search%' 
  OR `first_name` LIKE '%$search%' 
ORDER BY relevance DESC, username LIMIT 5

So basically, all I need to do is make $search = $_POST['search'] functional with this query… can anyone tell me how this is accomplished?

EDIT:
Looks like I can just use $.get… (which makes a lot of sense) rather than $.post (which is what I was used to) and get the same result. Feel free to correct me if I’m wrong, however I’m going to try this out and see how it goes.

  • 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-28T05:23:42+00:00Added an answer on May 28, 2026 at 5:23 am

    The short answer is that you shouldn’t do this.

    Now, the long answer …

    Why would you want to use $_POST for a read request in the first place? Let me introduce you to the concepts of safety and idempotence in the context of HTTP.

    The HTML 2.0 spec says:

    If the processing of a form is idempotent (i.e. it has no lasting
    observable effect on the state of the world), then the form method
    should be GET. Many database searches have no visible side-effects and
    make ideal applications of query forms.

    A bit about HTTP GET

    The HTTP verb GET was specifically created to retrieve a resource without any possibility of changing it. What I mean is that it’s safe. It doesn’t cause any side effects. A GET request in your case should be used to get data from a database and display it. Existing HTML pages, images requests, database searches, etc. … these are all safe requests that should be made with GET.

    Meanwhile, idempotent means that executing the request 724 times will have the same effect as doing it once. An idempotent request might create something in a database the first time, but it won’t do it again or it will just return the reference to it the next time around.

    The HTML spec continues …

    In particular, the convention has been established that the GET and
    HEAD methods SHOULD NOT have the significance of taking an action
    other than retrieval. These methods ought to be considered “safe”.
    This allows user agents to represent other methods, such as POST, PUT
    and DELETE, in a special way, so that the user is made aware of the
    fact that a possibly unsafe action is being requested.

    So, in summary, please understand that you shouldn’t use POST to perform safe, read-only operations.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a database search query which search in the database for a word
I have a simple script that does some search and replace. This is basically
I basically have a page which shows a processing screen which has been flushed
I'm using the code below for my search logic, basically, it evaluates a field
I'm building a search of sorts, which has various filters available. I want to
I have a little problem. I want to do automatic searching, but there is
I'm trying to create what is basically a timestamp search query. The user puts
I basically have the following flow: XML -> JSON -> Spring MVC -> jsp
I basically have something like this: void Foo(Type ty) { var result = serializer.Deserialize<ty>(inputContent);
I basically have three tables, posts, images and postimages (this simply contains the ids

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.