Avatar of DanielAttard
DanielAttard
Flag for Canada asked on

Add value to array using CodeIgniter

I am using CodeIgniter to generate some query results, and then in a second step using a foreach loop to run a method using values from the query result. What I would like to do now is to somehow combine the new variable with the original query. Here is the code so far:

$qryOriginal = $this->db->query("SELECT 1 as BAND, 
  tblappeals.Scenario, 
  tblappeals.Year, 
  tblappeals.var1, 
  tblappeals.var2 
  FROM tblappeals 
  WHERE tblappeals.Property = $pn ");

foreach ($qryOriginal->result() as $row)
{
$var3 = $this->getPhaseIn($calcyear, $row->var1, $row->var2);
    echo $var3; //HOW CAN I ADD THIS $var3 VALUE TO qryOriginal ???  
}

Open in new window

There must be an easy way to add this new value to the original query. I just don't know how to do it. I was thinking to use array_push(), but that doesn't seem to be the right function. Any ideas?
HTMLPHPMySQL Server

Avatar of undefined
Last Comment
DanielAttard

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Terry Woods

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
DanielAttard

ASKER
Thanks Terry, that was awesome.  You nailed it first shot.  Made my night.
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck