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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T13:22:09+00:00 2026-06-12T13:22:09+00:00

I am running a query on a dbase that returns a multi-field recordset or

  • 0

I am running a query on a dbase that returns a multi-field recordset or array on fetch. The array is multi-field as I need several fields to output to the screen. However, I then want to save an array of just one variable, the id for each record. to compare against another list of records. So I need to, in effect, strip all but one field from the array.

In effect, I want to reduce (not using proper array notation):

{1 red dog, 2 orange cat, 3 yellow canary}

to

{1,2,3}

Is there an easy way to do this?

Thanks in advance!

  • 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-12T13:22:10+00:00Added an answer on June 12, 2026 at 1:22 pm

    Basically what you want is called array plucking; here’s an RFC to introduce this into the language, but it hasn’t been accepted.

    In the meantime you’d just have to do it the old fashioned way:

    $a = array(
        array('id' => 1, 'title' => 'title1'),
        array('id' => 2, 'title' => 'title2'),
    );
    
    array_map(function($v) {
        return $v['id'];
    }, $a);
    
    // returns array(1, 2)
    

    Before 5.3 you’d have to write it like so:

    function getid($v)
    {
        return $v['id'];
    }
    
    array_map('getid', $a);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am running a query that returns records from the LEFT of the EXCEPT
im running a query that usses 3 tabels post, likes and comment i need
I have a long running query that returns a large data set. This query
i am wondering is that possible (best practice) to run two long running query
I'm running a query which looks like this SELECT parent.field, child.field FROM parent JOIN
I'm running a query that retrieves 20 rows (for example). I want to know
I'm running a query that is timing out for first two times and returning
I have a slow running query that I've been working on optimising. When looking
I am trying to speed up a long running query that I have (takes
I am running a query that looks something like this: ATTACH 'db2' as db;

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.