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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T01:08:16+00:00 2026-05-27T01:08:16+00:00

The table is like this and I want to update DecryptionDate by specify ArchiveID

  • 0

The table is like this

enter image description here

and I want to update DecryptionDate by specify ArchiveID and RecipientID

this is my code

$this->load->database();
$date = date("Y-m-d H:i:s");
$data = array('DecryptionDate' => $date);
$array = array('ArchiveID'=>$archiveID.'','RecipientID'=>$userID.'');
$this->db->where($array);
$this->db->update('log', $data);
if ($this->db->affected_rows() > 0) {
    echo "SUCCESS";
} else {
    echo "FAIL";
}

my problem is I can update the data only when $archiveID is 911 and $userID is test01 but the program fail to update when $archiveID is 911 and $userID is test02

after added echo $this->db->last_query(); I’ve got

UPDATE log SET DecryptionDate = ‘2011-11-16 20:01:39’ WHERE ArchiveID = ‘911’ AND RecipientID = ‘test01’

when ArchiveID is test01 and the update is SUCCESS

and

UPDATE log SET DecryptionDate = ‘2011-11-16 20:03:10’ WHERE ArchiveID = ‘911’ AND RecipientID = ‘test02’

when ArchiveID is test02 and the update is FAIL

I’ve try this

$this->load->database();
$date = date("Y-m-d H:i:s");
$this->db->query('UPDATE log
    SET DecryptionDate = \''.$date.'\'
    WHERE ArchiveID = \''.$archiveID.'\' AND RecipientID = \''.$userID.'\'');
if ($this->db->affected_rows() > 0) {
    echo "SUCCESS";
    return TRUE;
} else {
    echo "FAIL";
    return FALSE;
}

but the result’s still the same

and try check only the RecipientID like this

$this->load->database();
$date = date("Y-m-d H:i:s");
$this->db->query('UPDATE log
    SET DecryptionDate = \''.$date.'\'
    WHERE RecipientID = \''.$userID.'\'');
if ($this->db->affected_rows() > 0) {
    echo "SUCCESS";
    return TRUE;
} else {
    echo "FAIL";
    return FALSE;
}

make the update success with only record that match with the RecipientID but not with duplicate ArchiveID with other record

like this

enter image description here

Finally, I’ve test update with common php file with following code instead of via CI and also result is fail

$date = date("Y-m-d H:i:s");
$strSQL = "UPDATE log SET DecryptionDate = '".$date."' WHERE ArchiveID = '911' AND RecipientID = 'test02' ";
$objQuery = mysql_query($strSQL);
if( mysql_affected_rows($objQuery) != 0 ) 
{ 
    echo (" SUCCESS ");
} else { 

    echo (" FAIL ");
}

so I think this must be database problem

here is the DB structure
enter image description here

and ArchiveID and RecipientID are index

enter image description here

  • 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-27T01:08:17+00:00Added an answer on May 27, 2026 at 1:08 am

    I try export the data from database and truncate it then import the data back, it can help, the problem solved.

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

Sidebar

Related Questions

I want to have a database table that keeps data with revision history (like
I have an SQL table like this : sales(product,timestamp) I want to display a
i want to bulid a table layouts like this.how? alt text http://privateevent.co.uk/underground/img/gallery/19_1236343602.png
I want to do something like this: create table app_users ( app_user_id smallint(6) not
I have a database table like this: id version_id field1 field2 1 1 texta
I have a table like this: Application,Program,UsedObject It can have data like this: A,P1,ZZ
I want to update a row in sqlite. My query looks like this update
I want to update data from my database using java. I have established my
I'm using two tables in the database. The first table looks like this: id
I initialised my table like this /* POST data to server */ $(document).ready(function() {

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.