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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T19:21:14+00:00 2026-05-25T19:21:14+00:00

I have a CodeIgniter query that brings back an array of objects. My query

  • 0

I have a CodeIgniter query that brings back an array of objects. My query is querying multiple tables that all have the same field name. So I am using the select to give them aliases. Like this:

SELECT t1.platform_brief b1, t2.platform_brief b2

where t1 and t2 are my two tables. My array when print_r’d returns objects like this:

Array
(
    [0] => stdClass Object
        (
            [b1] => Lorem ipsum
            [b2] => 
        )

    [1] => stdClass Object
        (
            [b1] => 
            [b2] => Sic dolor sit
        )

)

In my foreach, when I echo them, how do I do that? I tried something like this but it didn’t work:

<?php foreach ($lasers as $laser) {
echo $laser->?
?>

What do I put in place of the question mark?

EDIT:

Here is my CI query:

$this->db->select('ils1.platform_brief b1, ils2.platform_brief b2');
$this->db->where('ils1.language', $lang);
$this->db->or_where('ils2.language', $lang);
$this->db->join('all_platform_ils975 ils2', 'ils2.laser_id = c.laser_id', 'left');
$this->db->join('all_platform_ils1275 ils1', 'ils1.laser_id = c.laser_id', 'left');
$this->db->join('all_lasers l', 'l.laser_id = c.laser_id', 'inner');
return $this->db->get($lang . '_configure_lasers c')->result();
  • 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-05-25T19:21:15+00:00Added an answer on May 25, 2026 at 7:21 pm

    You could iterate over each object:

    foreach ($lasers as $laser) {
        foreach($laser as $field) {
            if(!empty($field)) echo $field;
        }
    }
    

    However, instead you should change the database design / query design to better meet your needs.

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

Sidebar

Related Questions

In Kohana/CodeIgniter, I can have a URL in this form: http://www.name.tld/controller_name/method_name/parameter_1/parameter_2/parameter_3 ... And then
i've a MySQL query that should return some rows that have the letters Ö
I'm running an MySQL query that returns results based on location. However I have
I have 2 tables: user_tb.username user_tb.point review_tb.username review_tb.review I am coding with PHP(CodeIgniter). So
My issue is i have QUERY_STRING enabled in my codeigniter setup so that links
In my LAMP application (using CodeIgniter), I have a call to $this->db->update... that generates
I have used PHP for awhile now and have used it well with CodeIgniter,
I have a query where I need to modify the selected data and I
Using CodeIgniter's Active Record class and MySQL, I have a table of posts with
I am using Codeigniter framework and I have a form with input fields. When

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.