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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T05:39:34+00:00 2026-06-18T05:39:34+00:00

// Setup Query $query = $this->db->query(‘SELECT * FROM here’); // Pull in the appropriate

  • 0
// Setup Query
$query = $this->db->query('SELECT * FROM here');

// Pull in the appropriate data for the model
$toolkitName = $this->toolkits_model->find_by('id', $id);

// Strip the commas from incoming array
$matchMeCommas = $toolkitName->toolkits_listitems; 
$matchMe = explode(',', $matchMeCommas);    

// Print ID for each item in toolkit parent list
foreach ($query->result_array() as $row) :
echo $row['id'];
endforeach;

// Match each item from toolkit list item
foreach ($matchMe as $row2) :
echo $row2;
endforeach;

What I’m trying to do is match the values from these two arrays and print the results from the parent list item. Currently what happens is that I get two strings of “234567891011” which relates to the ID (2, 3, 4, 5, ect).

I should add that I would want to match like values and pull results for that specific ID. So if the values 2 & 4 match I would want to retrieve their information from the DB and print it.

Any ideas? Thanks!

  • 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-18T05:39:35+00:00Added an answer on June 18, 2026 at 5:39 am

    Still not exactly sure what you want, but this could get you started:

    foreach($query->result_array() as $row){
        if(in_array($row['id'], $matchMe)){
            //this is a match ... do something
        }
    }
    

    OR

    You could build an array of all matches:

    //get the ids from the query
    $ids = array();
    foreach($query->result_array() as $row){
        $ids[] = $row['id'];
    }
    
    $matches = array_intersect($matchMe, $ids);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I try this query from Oracle : select * from a_table@Postgres; Here is the
For example this query: SELECT `variants`.* FROM `variants` INNER JOIN `variant_attributes` ON variant_attributes.variant_id =
Alright I have the MYSQL query code setup to pull this information out of
I have this query: <?php $query= SELECT wposts.* FROM $wpdb->posts wposts, $wpdb->postmeta wpostmeta WHERE
I am trying to run this query: $record = Doctrine_Query::create() ->select('m.*') ->from('Modification m') ->leftJoin('m.Location
I currently have this query set-up: SELECT topic.content_id, topic.title, image.location FROM mps_contents AS topic
I currently have this query set-up: SELECT topic.content_id, topic.title, image.location FROM mps_contents AS topic
This code not work correctly: getHibernateTemplate() .find(from elephant.model.Setup s where s.settingName = ?,setupName); Error:
This is how I have my current query setup: SELECT * , ( SELECT
I need to pull a query like this one $result = mysql_query( SELECT id,

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.