Welcome Guest, Not a member yet? Register   Sign In
populating an associative array from an sql return stryct
#4

(This post was last modified: 08-25-2018, 02:58 PM by richb201.)

I create MY_array_helper and put it in the helpers directory. I load it with:

     $this->load->helper('string','MY_array_helper');

And then I try calling it with

$data=objectToArray($result);

The $result struct is from my call to mySQL Query(). I get Message: Call to undefined function objectToArray(). Is the result from the mysql query an object? Perhaps I want to do $data2=objectToArray($result) instead, and then have:

          $data = array(
           'email' => $data2->email,
           'year' => $data2->year,
           'campaign' => $data2->campaign,
           'data_time' => uniqid(),
           'hours' => $data2->hours,
           'week' => $data2->week,
           'business_component' => $data2->business_comp,
           'project' => $data2->project,
          'activity' => $data2->activity);
proof that an old dog can learn new tricks
Reply


Messages In This Thread
RE: populating an associative array from an sql return stryct - by richb201 - 08-25-2018, 02:55 PM



Theme © iAndrew 2016 - Forum software by © MyBB