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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T06:39:10+00:00 2026-06-04T06:39:10+00:00

I am making some changes to a site using ExpressionEngine, there is a concept

  • 0

I am making some changes to a site using ExpressionEngine, there is a concept I can’t seem to quite understand and am probably coding workarounds that have pre-provided methods.

Specifically with channels and members, the original creator has added several custom fields. I am from a traditional database background where each column in a table has a specific meaningful name. I am also used to extending proprietary data by adding a related table joined with a unique key, again, field names in the related table are meaningful.

However, in EE, when you add custom fields, it creates them in the table as field_id_x and puts an entry into another table telling you what these are.

Now this is all nice from a UI point of view for giving power to an administrator but this is a total headache when writing any code.

Ok, there’s template tags but I tend not to use them and they are no good in a database query anyway.

Is there a simple way to do a query on say the members table and then address m_field_1 as what its really called – in my case “addresslonglat”.

There are dozens of these fields in the table I am working on and at the moment I am addressing them with fixed names like “m_field_id_73” which means nothing.

Anybody know of an easy way to bring the data and its field names together easily?

Ideally i’d like to do the following:

$result = $this->EE->db->query("select * from exp_member_data where member_id = 123")->row();
echo $result->addresslonglat;

Rather than

echo $result->m_field_id_73;
  • 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-04T06:39:11+00:00Added an answer on June 4, 2026 at 6:39 am

    This should work for you:

    <?php    
    $fields = $data = array();
    $member_fields = $this->EE->db->query("SELECT m_field_id, m_field_name FROM exp_member_fields");
    foreach($member_fields->result_array() as $row)
    {
        $fields['m_field_id_'.$row['m_field_id']] = $row['m_field_name'];
    }
    
    $member_data = $this->EE->db->query("SELECT * FROM exp_member_data WHERE member_id = 1")->row();
    foreach($member_data as $k => $v)
    {       
        if($k != 'member_id')
        {
            $data[$fields[$k]] = $v;
        }
    }
    print_r($data);
    ?>
    

    Then just use your new $data array.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Iphone changes some fonts making the site unproportional and not as originally designed. Is
I'm in the process of making some changes to my site, and I'm running
I inherited a Drupal5 site and have been tasked with making some changes, but
Im making some SEO changes to our site and right now im having some
I am making some changes on the live site and i constantly need to
After making some changes in my models (eg. new field in a model and
I'm making some changes to a legacy classic ASP application. I've made the changes
I've spent most of the day making what are basically some housekeeping changes to
I'm using Selenium for making some work: script should click at link followed by
In Core Data, is there some trick to saving changes to managed objects' attributes

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.