Need a mysql query to extract data from mm-forms

Posted by Kirill on Stack Overflow See other posts from Stack Overflow or by Kirill
Published on 2010-06-07T09:26:23Z Indexed on 2010/06/07 11:32 UTC
Read the original article Hit count: 354

Filed under:
|
|

http://cl.ly/201a11b430bf60ef9e97

is what the rows look like, after I clean them up a bit:

SELECT fk_form_joiner_id,form_key,value FROM wp_contactform_submit_data WHERE form_key!='page_post_id' AND form_key!='captcha-802' AND form_key!='page_post_title' AND form_key!='user_ID'

What I need is a query where it would transform this into a structure like:

id | First-name | Surname-name | your-email | dob | address-1 | address-2 | county | postcode | phone
-------------------------------------------------------------------------------------------------------
88 | jack       | Somethin     | [email protected]    | dob | (etc)

I think I know a way to do this through php, but I think there must be a way to do it as a mysql query.

Ultimately, I need to export this (into a csv), but if you could give me a query that would output this into a mysql table (or at least a workable select query, that I could then turn into an insert query loop, to create a table), I'd do it form there.

Thank you.

© Stack Overflow or respective owner

Related posts about php

Related posts about mysql