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?

Taz
  • 3,718
  • 2
  • 37
  • 59

1 Answers1

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:

Community
  • 1
  • 1
Janci
  • 3,198
  • 1
  • 21
  • 22