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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T10:11:59+00:00 2026-06-13T10:11:59+00:00

I hope someone can help me. I need to extract certain details (Full Name

  • 0

I hope someone can help me. I need to extract certain details (“Full Name and Surname”, “Email”, “Contact Number) from a MySQL DB but can’t figure out how to do this. The application in question, “Grunion Contact Form” for WordPress saves the data in the DB, in an array, as follows:

Array
(
    [Full Name and Surname:] => Sharon Somerset
    [Email] => sharon@x.x.x
    [Contact Number:] => 08xxxxxx
    [Alternative Number] => 011xxxxxx
    [Please list convenient time to be contacted] => 
    [Medical Aid Quote] => Yes
    [Insurance Quote] => 
    [Policy Update] => 
    [Friend's Name and Surname:] => 
    [Friend's Contact Number:] => 
    [How did you find us?] => Google
)

Each entry is in it’s own database row, inside “longtext” field.

How can I easily extract “Full Name and Surname”, “Email”, “Contact Number” data from a few thousands rows like this, and re-save in a simple table or CSV file to import into something like phplist

  • 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-06-13T10:12:01+00:00Added an answer on June 13, 2026 at 10:12 am

    This should get you started – its simple regular expression matching on the text field. This will take a while to run through – but it does what you need.

    <?php
    $string = "Array
    (
        [Full Name and Surname:] => Sharon Somerset
        [Email] => sharon@x.x.x
        [Contact Number:] => 08xxxxxx
        [Alternative Number] => 011xxxxxx
        [Please list convenient time to be contacted] => 
        [Medical Aid Quote] => Yes
        [Insurance Quote] => 
        [Policy Update] => 
        [Friend's Name and Surname:] => 
        [Friend's Contact Number:] => 
        [How did you find us?] => Google
    )";
    
    
    $string = preg_replace("/Array\n\(\n/","",$string);
    //remove first line
    
    $string = preg_replace("/\)$/","",$string);
    //remove last line
    
    $lines = explode("\n",$string);
    //split on new lines
    print_r($lines);
    
    foreach($lines as $l)
    {
            preg_match("/\[(.+)\] => (.*)$/",$l,$matches);
            //$matches[1] will contain the label
            //$matches[2] will contain the value
            print_r($matches);
    
    }
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to do a non greedy match and hope someone can help me.
I am stuck and in need of a hand. Hope someone can help? Anyone
I hope someone can help me. I need to notify user after he successfully
I need some help and hope someone can help me with this issue: hturl
I hope someone can help me with the following: I need to know if
Hello I hope someone can help me. I need to know how to write
I really hope someone can help me along with this one... I need to
hope someone can help. I have two tables: Users -UserID -UserName UsersType -UserTypeID -UserID
Hope someone can help i cant seem to get my head around this, i
Hope someone can help me out with this problem I am having. I just

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.