开发者

MySQL not updating single field in database while updating others

开发者 https://www.devze.com 2023-01-22 18:16 出处:网络
I am using Zend Framework 1.10.8 and MySQL Server开发者_JAVA百科 5.1.X.I create my data array to update the record but only one field updates.

I am using Zend Framework 1.10.8 and MySQL Server开发者_JAVA百科 5.1.X. I create my data array to update the record but only one field updates.

<?php 
    $where = "`character_id` = '5'";
    $healthGained = 5;
    $data = array();
    if ($healthGained > 0) {
        $data['character_current_health'] = $character['character_max_health'] + $healthGained;
        $data['character_max_health'] = $character['character_max_health'] + $healthGained;
        print_r($data);
        $characterInfoTable->update($data, $where);
    }
?>

What I get from the print_r is this:

Array ( [character_current_health] => 430 [character_max_health] => 430 )

However the value of character_current_health does not change in the database. The value of character_max_health does however. Anyone know what is going on with this?

NOTE: The fields are named correctly and are the correct data type. This is running on a Linux server running Ubuntu.


Geeez! Nevermind. I am an idiot sometimes. It was updating correctly but due to a poor flow of operations, I re-updated the table with the wrong value.

0

精彩评论

暂无评论...
验证码 换一张
取 消