Line 77... |
Line 77... |
77 |
// if value is null or equals the default value then don't add it
|
77 |
// if value is null or equals the default value then don't add it
|
78 |
else if (isset($default_vals["$key"]) && ($val == '' || check_defaults($val,$op_val,$default_vals["$key"])))
|
78 |
else if (isset($default_vals["$key"]) && ($val == '' || check_defaults($val,$op_val,$default_vals["$key"])))
|
79 |
continue;
|
79 |
continue;
|
80 |
// if value differs from the sql value then update
|
80 |
// if value differs from the sql value then update
|
81 |
else{
|
81 |
else{
|
82 |
if (isset($item_vals["$key"][$j])){
|
82 |
if (isset($item_vals["$key"][$j]) && (isset($old_val) && $old_val !='') || $sql_attr=='Filter-Id'){
|
83 |
$old_val = $item_vals["$key"][$j];
|
83 |
$old_val = $item_vals["$key"][$j];
|
84 |
$old_val = da_sql_escape_string($link, $old_val);
|
84 |
$old_val = da_sql_escape_string($link, $old_val);
|
85 |
$res = da_sql_query($link,$config,
|
85 |
$res = da_sql_query($link,$config,
|
86 |
"UPDATE $table SET value = '$val' WHERE $query_key = '$login' AND
|
86 |
"UPDATE $table SET value = '$val' WHERE $query_key = '$login' AND
|
87 |
attribute = '$sql_attr' AND value = '$old_val';");
|
87 |
attribute = '$sql_attr' AND value = '$old_val';");
|
- |
|
88 |
|
- |
|
89 |
if (!$res || !da_sql_affected_rows($link,$res,$config))
|
- |
|
90 |
echo "<b>Change failed for attribute $key: " . da_sql_error($link,$config) . "</b><br>\n";
|
88 |
}
|
91 |
}
|
89 |
if(isset($val) && $val != ''){
|
92 |
else{
|
90 |
$res = da_sql_query($link,$config,
|
93 |
$res = da_sql_query($link,$config,
|
91 |
"INSERT INTO $table ($query_key,attribute,value $text2)
|
94 |
"INSERT INTO $table ($query_key,attribute,value $text2)
|
92 |
VALUES ('$login','$sql_attr','$val' $op_val2);");
|
95 |
VALUES ('$login','$sql_attr','$val' $op_val2);");
|
93 |
if (!$res || !da_sql_affected_rows($link,$res,$config))
|
96 |
if (!$res || !da_sql_affected_rows($link,$res,$config))
|
94 |
echo "<b>Change failed for attribute $key: " . da_sql_error($link,$config) . "</b><br>\n";
|
97 |
echo "<b>Change failed for attribute $key: " . da_sql_error($link,$config) . "</b><br>\n";
|