0

A MySQL (5.5.8) table (named usage_log) stores thousands of PHP $_SERVER['REQUEST_URI'] variables:

 id     | request_uri
--------|---------------------------------------------------------
 ...    | ...
 123456 | page_one.php?foo=123&bar=smtgh1&more=no&even_more=yes
 123457 | page_two.php
 123458 | page_twelve.php?get=123&a=letter
 ...    | ...

Using MySQL query, I want to filter names of $_GET variables from request_uri strings, to receive something like this:

 get_vars
--------------------------------
 ...
 foo, bar, more, even_more
 get, a
 ...

This definitely looks like a job for regexp but MySQL regexp function returns 0 or 1, so there's not much use of it, I guess. Is what I want even feasible in My SQL?

1 Answer 1

1

You can't do this directly in MySQL but you could use MySQL User-defined functions. Hovever, I'd advise to do this transformation in PHP if possible.

Related/duplicate SO questions:

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks. This is useful. I can't vote your answer, but I will as soon as I can.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.