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

  • Home
  • SEARCH
  • 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 8068011
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T12:31:11+00:00 2026-06-05T12:31:11+00:00

I’m getting an odd error when attemping to pass an array to a function

  • 0

I’m getting an odd error when attemping to pass an array to a function which updates data in a MySQL table.

My trigger

$input_data = array(
  'field0' => 'abc',
  'field1' => '123'
);

// var dump #1
var_dump($input_data);
// gives expected result (2 element array)

$this->user->update_user_info($input_data);

User model

function update_user_info($new_data) {
    // var dump #2
    var_dump($new_data);

    // this gives:
    // array(2) {
    //    ["field0"] => string(3) "abc"
    //    ["field1"]=> string(3) "123"
    // }
    // NULL
}

Where is that ending NULL coming from?? I am trying to use this with Codeigniter’s active Record Update class and it fails because of that NULL.

I’ve attempted to copy it to a new array by looping through a foreach, but the NULL value follows to the new array, even though it doesn’t appear to be in the array.

Any help would be appreciated.

  • 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-05T12:31:13+00:00Added an answer on June 5, 2026 at 12:31 pm

    Apologies for the above ‘Answer’, I’m new to the site and couldn’t see the comment button :p

    I’ve since solved this problem in terms of my own circumstances and possibly this may apply to you.

    As I said earlier my problem was identical, the cause was not correctly returning both functions – I returned the secondary function i.e the one that my array was passed to like so.

    function update_user_info($new_data) {
    
        // var dump #2
        var_dump($new_data);
        return;
    
    }
    

    but in the first function I was not returning after calling the second function, hope that makes sense and that this helps you too, it was frustrating as hell for me!

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I want to construct a data frame in an Rcpp function, but when I
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
I would like to run a str_replace or preg_replace which looks for certain words
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have a text area in my form which accepts all possible characters from
I need a function that will clean a strings' special characters. I do NOT
I have some data like this: 1 2 3 4 5 9 2 6

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.