views:

45

answers:

1

I am using Zend Framework 1.10.8 and MySQL Server 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.

A: 

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.

Dennis Day
So often the cause of these 'weird' errors. When something like this happens it's hard to debug until you give up all your assumptions!
David Caunt