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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T12:34:25+00:00 2026-06-14T12:34:25+00:00

I am inserting data to database using codeigniter. But it keeps giving me below

  • 0

I am inserting data to database using codeigniter. But it keeps giving me below error

Unknown column 'Array' in 'field list'</p><p>INSERT INTO `profile` (`loginid`, `name`, `email`, `gender`, `birthday`, `profilePhoto`, `date`) VALUES (Array, 'Zafar Khan', 'xafar@demo.com', 'male', '20.01.1987', '', '2012/11/19')

Filename: /Applications/XAMPP/xamppfiles/htdocs/membership_system/models/model_register.php</p><p>Line Number: 48

Here is the code where this error occurs

public function saveUserProfile() {
    $userId = $this->readUserId();

    $profile = array(
            'loginid'       => $userId,
            'name'          => $this->input->post('name'),
            'email'         => $this->input->post('email'),
            'gender'        => $this->input->post('gender'),
            'birthday'      => $this->input->post('birthday'),
            'profilePhoto'  => '',
            'date'          => date("Y/m/d")
        );

    $query = $this->db->insert('profile', $profile);

    if ($query) {
        return true;
    } else {
        return false;
    }
}

UPDATE

here is readUserId function

private function readUserId() {
    $this->db->select('id'); 
    $this->db->from('login');   
    $this->db->where('email', $this->input->post('email'));

    return $this->db->get()->result();
}

UPDATE 2

Here is my output for var_dump

array(1) {  [0]=>  object(stdClass)#18 (1) {    ["id"]=>    string(2) "14"  } }
  • 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-14T12:34:26+00:00Added an answer on June 14, 2026 at 12:34 pm

    Seems that $this->readUserId() returns an Array.
    Can you try reset($this->readUserId()); ?
    Put it before initializing $profile.

    Or just

    echo var_dump( $this->readUserId() );
    
    die();
    

    ..So that we can see what’s inside your variable.

    ==> EDIT:

    $profile must become something like

    $profile = array(
                'loginid'       => $userId['id'],
                'name'          => $this->input->post('name'),
                'email'         => $this->input->post('email'),
                'gender'        => $this->input->post('gender'),
                'birthday'      => $this->input->post('birthday'),
                'profilePhoto'  => '',
                'date'          => date("Y/m/d")
            );
    

    ==> EDIT 2:

    Okay, then you can add

    $userId = $userId[0]->id;
    

    Before the $profile variable initialization.

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

Sidebar

Related Questions

I am using below code for inserting data in the database. and i am
I'm inserting data from a jsf page to database using managed beans. But the
I have following code for inserting data into database using PDO. It inserts data
In my c# application i am inserting data into sqlite database as below String
Getting error while inserting values into database (SQL Server 2008) Implicit conversion from data
I am using Codeigniter to pass an array of data from a controller into
I'm inserting some data into a database from a form. I'm using addslashes to
I am using mysql_real_escape_string function while inserting the data into MySQL database. I am
I make an application for querying from and inserting data to the database using
I am inserting data into my database using the following code: $this->db->set('event_id', $event_id); ...

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.