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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T00:58:17+00:00 2026-05-19T00:58:17+00:00

I’m having some trouble updating records with the Codeigniter framework. I’m using the MVC

  • 0

I’m having some trouble updating records with the Codeigniter framework. I’m using the MVC pattern and active records.

The code is for updating user profiles.

In my model, Profile_model I have a function to update…

function profile_update() 
    {
        $this->db->where('user_id', 2);
        $this->db->update('user_profiles', $data);              
    }

The controller Profile_crud should retrieve data from a form and send the data to the model.

function update() 
    {
        $data = array (
            'country' => $this->input->post('country'),
            'website' => $this->input->post('website')         
        );

        $this->load->model('Profile_model');
        $this->Profile_model->profile_update($data);
    }

and the form in my view profile.php On submit it triggers the update function in my controller.

Update

<?php echo form_open('profile_crud/update'); ?>

<p>
<label for="country">Country</label>
<input type="text" name="country" id="country" />
</p>
<p>
<label for="website">Website</label>
<input type="text" name="website" id="website" />
</p>

<p><input type="submit" value="Save" /></p>

<?php echo form_close(); ?>

When I submit the form I get 3 types of errors.

A PHP Error was encountered

Severity: Notice

Message: Undefined variable: data

Filename: models/profile_model.php

Line Number: 27

line 27 is $this->db->update('user_profiles', $data);

A PHP Error was encountered

Severity: Warning

Message: Cannot modify header
information – headers already sent by
(output started at
/home1/requestg/public_html/housedwork/system/libraries/Exceptions.php:166)

Filename: codeigniter/Common.php

Line Number: 356

and

A Database Error Occurred

You must use the “set” method to
update an entry.

I’m not sure what I’m doing wrong.. Can someone please help?

  • 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-19T00:58:17+00:00Added an answer on May 19, 2026 at 12:58 am

    For your profile_update function, you are specifying the argument of $data:

    $this->Profile_model->profile_update($data);
    

    But in your model function, you have not specified one:

    function profile_update() 
    {
        $this->db->where('user_id', 2);
        $this->db->update('user_profiles', $data);              
    }
    

    It should be:

    function profile_update($data) 
    {
        $this->db->where('user_id', 2);
        $this->db->update('user_profiles', $data);              
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
We're building an app, our first using Rails 3, and we're having to build
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I'm making a simple page using Google Maps API 3. My first. One marker
I have some data like this: 1 2 3 4 5 9 2 6
Seemingly simple, but I cannot find anything relevant on the web. What is the

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.