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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T11:18:40+00:00 2026-05-29T11:18:40+00:00

I got the data , that are going to be saved into my database

  • 0

I got the data , that are going to be saved into my database using the CI’s database class:

$data = array(
    'login' => $this->input->post('login', TRUE),
    'password' => $this->input->post('password', TRUE),
    'email' => $this->input->post('email', TRUE)
);

return $this->db->insert('account', $data);

Now I need to use the MySQL function PASSWORD() to get the password post hash.

I’ve tried this way:

'password' => "PASSWORD(" . $this->input->post('password', TRUE) . ");

But CI’s database class convert it to the following string:

INSERT INTO `accounts` [..] 'PASSWORD("mypassword")'

so as you can see, it won’t work since it will save the whole string between '.

Is there any solution for this or I’d have to use the $this->db->query ?

  • 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-29T11:18:41+00:00Added an answer on May 29, 2026 at 11:18 am

    You can use the set() method to set your INSERT values, and then pass a third parameter (FALSE) to prevent CodeIgniter from escaping PASSWORD. Something like this:

    $this->db->set('login', $this->input->post('login', TRUE));
    $this->db->set('password', 'PASSWORD("'.$this->input->post('password', TRUE).'")', FALSE);
    $this->db->set('email', $this->input->post('email', TRUE));
    
    return $this->db->insert('account');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got some binary data that I store and was going to separate this
I've got a data structure that is a hash that contains an array of
I've got a SQLServer Database and an application (.NET) that configures data on that
I've got some data files that are stored compressed on our company's server with
I've got a data structure that is Key, Value, OtherValues(key, Value). So the OtherValues
I've got data in SQL Server 2005 that contains HTML tags and I'd like
I've got a lot of mysql data that I need to generate reports from.
We've got a bunch of data that we'd like to expose to the world
I've got about 25 tables that I'd like to update with random data that's
I've got some data (the output of a ddply function) that I want to

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.