@@ -63,7 +63,7 @@
$row = $res->fetchRow(MDB2_FETCHMODE_ASSOC);
$systemid = $row['id'];
- foreach ( $data as $key ) {
+ foreach ( $data as $key => $value ) {
// check if systemid/key pair exists
$sysidkeysql = "SELECT inv_system_id, datakey FROM inv_system_properties WHERE inv_system_id='$systemid' AND datakey='$key'";
$sysidkeyres = $dbh->query($sysidkeysql);
@@ -72,7 +72,7 @@
syslog(LOG_ERR, "MDB2: " . $sysidkeyres->getMessage());
} elseif ( $sysidkeyres->numRows() == 1 ) {
// define update query
- $updatesql = "UPDATE inv_system_properties SET value='$data[$key]', WHERE inv_system_id='$systemid' AND datakey='$key'";
+ $updatesql = "UPDATE inv_system_properties SET value='$value' WHERE inv_system_id='$systemid' AND datakey='$key'";
$updres = $dbh->exec($updatesql);
if (PEAR::isError($updres) ){
syslog(LOG_ERR,"MDB2: UPDATE of inv_system_properties failed with " . $updres->getMessage());
@@ -80,7 +80,7 @@
} elseif ( $sysidkeyres->numRows() == 0 ) {
// if systemid / key pair does not exist, create it - happens on feature update
- $insertsql = "INSERT INTO inv_system_properties (inv_system_id,datakey,value) VALUES ('$systemid','$key','$data[$key]')";
+ $insertsql = "INSERT INTO inv_system_properties (inv_system_id,datakey,value) VALUES ('$systemid','$key','$value')";
$insres = $dbh->exec($insertsql);
if (PEAR::isError($insres) ){
syslog(LOG_ERR,"MDB2: INSERT into inv_system_properties failed with " . $insres->getMessage());
@@ -110,14 +110,14 @@
syslog(LOG_ERR, "MDB2: " . $sysidkeyres->getMessage());
} elseif ( $sysidkeyres->numRows() == 1 ) {
// define update query
- $updatesql = "UPDATE inv_system_properties SET value='$data[$key]', WHERE inv_system_id='$systemid' AND datakey='$key'";
+ $updatesql = "UPDATE inv_system_properties SET value='$value' WHERE inv_system_id='$systemid' AND datakey='$key'";
$updres = $dbh->exec($updatesql);
if (PEAR::isError($updres) ){
syslog(LOG_ERR,"MDB2: UPDATE of inv_system_properties failed with " . $updres->getMessage());
}
} elseif ( $sysidkeyres->numRows() == 0 ) {
// if systemid / key pair does not exist, create it - happens on feature update
- $insertsql = "INSERT INTO inv_system_properties (inv_system_id,datakey,value) VALUES ('$systemid','$key','$data[$key]')";
+ $insertsql = "INSERT INTO inv_system_properties (inv_system_id,datakey,value) VALUES ('$systemid','$key','$value')";
$insres = $dbh->exec($insertsql);
if (PEAR::isError($insres) ){
syslog(LOG_ERR,"MDB2: INSERT into inv_system_properties failed with " . $insres->getMessage());
|