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

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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T13:45:09+00:00 2026-05-24T13:45:09+00:00

the question might be a bit confusing, so here is what i have: i

  • 0

the question might be a bit confusing, so here is what i have:

i insert in the database the previous link where a person came from like tihs:

$came_from = $_SERVER['HTTP_REFERER']; // get previous link

if the link is from google.com it will come like this:

http://www.google.com/#sclient=psy&hl=en&source=hp&q=this+is+a+test&pbx=1&oq=this+is+a+teat&aq=f&aqi=g-s1g-v1&aql=1&gs_sm=s&gs_upl=887l82702l3.10.3.1l17l0&bav=on.2,or.r_gc.r_pw.r_cp.&fp=c3d3303&biw=1920&bih=995

if we look inside we can find q=this+is+a+testas beeing the keywords that i search for.

my question is how can i create a query to return http://www.google.com/ | this+is+a+test ?

i know that the keywords have the + sign in between them.

so far i came up with this, but not exactly what i wanted:

SELECT SUBSTRING_INDEX (table, '+', 1), table FROM table.table WHERE table LIKE '%+%' LIMIT 20

any ideas?

thanks

edit: what happend is that sometimes i get some other url’s that don’t have q= but maybe seearch=, so i want to keep track of the + sign

  • 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-24T13:45:10+00:00Added an answer on May 24, 2026 at 1:45 pm

    As it’s been pointed out, you can’t reliably get the keywords without supplying the parameters to look for. Here’s what I would do:

    $url = 'http://www.google.com/#sclient=psy&hl=en&source=hp&q=this+is+a+test&pbx=1&oq=this+is+a+teat&aq=f&aqi=g-s1g-v1&aql=1&gs_sm=s&gs_upl=887l82702l3.10.3.1l17l0&bav=on.2,or.r_gc.r_pw.r_cp.&fp=c3d3303&biw=1920&bih=995';
    
    $possible = array('q', 'ssearch', 'oq');
    
    $query_str = NULL;
    foreach ($possible as $search) {
        if (isset($arr[$search])) {
            $query_str = $arr[$search];
            break;
        }
    }
    

    Basically all this does is parse the url using PHP’s parse_str() and look for the parameter q. If it’s not there, it uses ssearch, and then oq. You can add more of them if you need to. If by the end of it it’s not found, $query_str will be NULL.


    Unless you have a very compelling reason to do it with MySQL only, just process everything on the PHP side. Databases are made to store data, not process it. What I would do is have PHP figure out the search engine and the keywords used and insert those into the DB, as separate fields. ie, have a table like so:

    search_engine | query_str
    ------------- | -----------
    google        | test
    yahoo         | something
    ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This might be a bit of a silly question but; If I have two
This might sound like a little bit of a crazy question, but how can
This question might be kind of elementary, but here goes: I have a SQL
This might seem like a stupid question I admit. But I'm in a small
OK, this might sound a bit confusing and complicated, so bear with me. We've
This question might not seem programming related at first, but let me explain. I'm
Although my question might seem abstract I hope it's not. Suppose I develop an
I know this question might sound a little cheesy but this is the first
Warm Standby SQL Server/Web Server This question might fall into the IT category but
This might be an interesting question. I need to test that if I can

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.