Problem. Despite the fact that the array $settings
has (int) values in them, MySQL writes NULL
to the table when the value is 0 and 2.
For reference, each index in an array $settings
is an array of [0] = max
and [1] = min
.
public function updateAdaptiveArmour($gameid, $shipid, $settings){
foreach ($settings as $key => $value){
debug::log($key." ".$value[0]." ".$value[1]);
}
try {
if ($stmt = $this->connection->prepare(
"UPDATE
tac_adaptivearmour
SET
particlealloc = ?,
laseralloc = ?,
molecularalloc = ?
WHERE
gameid = ?
AND shipid = ?
"
))
{
$stmt->bind_param('iiiii', $settings[0][1], $settings[1][1], $settings[2][1], $gameid, $shipid);
$stmt->execute();
$stmt->close();
}
}
catch(Exception $e) {
throw $e;
}
}
Ideally, for this example, I would like to UPDATE 2/0/0 instead of null / null / null.
source
share