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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T11:33:53+00:00 2026-06-14T11:33:53+00:00

I have a form that updates an MD5 encrypted password. At this point in

  • 0

I have a form that updates an MD5 encrypted password. At this point in the process the password field has been updated to a random token that was then sent to the user via email as part of a link and then that token is used to match up the account to update.

I have to check two tables because we broke out the admin and users into different tables. I’m getting the following SQL error. SQL and CodeIgniter are both pretty new to me.

SQL Error:

Error Number: 1064

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UNION UPDATE staff SET staff_password = '098f6bcd4621d373cade4e832627b4f6' WHERE' at line 1

UPDATE admin SET admin_password = '098f6bcd4621d373cade4e832627b4f6' WHERE admin_password = 'fd323219f98afd367fee9907173012db' UNION UPDATE staff SET staff_password = '098f6bcd4621d373cade4e832627b4f6' WHERE staff_password = 'fd323219f98afd367fee9907173012db'

Model Code:

public function update_password() {
    $sql = "UPDATE admin SET admin_password = ? WHERE admin_password = ? UNION UPDATE staff SET staff_password = ? WHERE staff_password = ?";
    $password = $this->input->post('password');
    $token = $this->input->post('token');
    $query = $this->db->query($sql, array($password, $token, $password, $token));

    if($query->num_rows() == 1) {
        return true;
    } else {
        return false;
    }
}

The token is set as a hidden field in the view:

<input type="hidden" name="token" value="<?php echo $token;?>" id="token">
  • 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-14T11:33:54+00:00Added an answer on June 14, 2026 at 11:33 am

    You can update the tables individually:

    $this->db->update('admin',array('admin_password'=>'098f6bcd4621d373cade4e832627b4f6'),'id = 123');
    $this->db->update('staff',array('staff_password'=>'098f6bcd4621d373cade4e832627b4f6'),'id = 456');
    

    You could also use method chaining:

    $this->db->where('id','123')->update('admin',array('admin_password'=>'newpass'));
    

    As tadman said, much better to check on the users ID rather than the password.

    Check out https://www.codeigniter.com/userguide2/database/active_record.html

    And for future reference: https://www.codeigniter.com/userguide2/libraries/encryption.html

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

Sidebar

Related Questions

I have a form that has a combobox . I need this combobox value
I have an AJAX based application that updates a text field in a form
I have an Ajax form that updates a div when submitted with a submit
I have an html/php form that updates entries on the database server. I need
I have a form that auto submits and updates the same page. I have
I currently have form that checks if a user has unsubmitted changes when they
I have a website that updates the users location through the use of form
I have a button on my windows form that calls the RunWorkerAsync() method, this
Ok so in my html/js i have a form that updates based on the
can't find an answer to this one... I have a form that detects changed

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.