Subversion Repositories ALCASAR

Compare Revisions

Ignore whitespace Rev 2046 → Rev 2047

/web/acc/manager/lib/sql/change_attrs.php
87,41 → 87,31
$res = da_sql_query($link,$config,
"UPDATE $table SET value = '$val' WHERE $query_key = '$login' AND
attribute = '$sql_attr' AND value = '$old_val';");
#if filter-id does not exit, we create it (ALCASAR 2.9.2 DDB)
// if filter-id does not exit, we create it (ALCASAR 2.9.2 DDB)
if (!$res || !da_sql_affected_rows($link,$res,$config))
$res = da_sql_query($link,$config,"INSERT INTO $table ($query_key,attribute,value $text2) VALUES ('$login','$sql_attr','00000000', ':=');");
if (!$res || !da_sql_affected_rows($link,$res,$config))
echo "<b>Change failed for attribute $key: " . da_sql_error($link,$config) . "</b><br>\n";
}
else{
if($val != ''){
$old_val = $item_vals["$key"][$j];
$old_val = da_sql_escape_string($link, $old_val);
 
$res = da_sql_query($link,$config,
"UPDATE $table SET value = '$val' WHERE $query_key = '$login' AND
attribute = '$sql_attr' AND value = '$old_val';");
#if attribute does not exist, we create it.
if (!$res || !da_sql_affected_rows($link,$res,$config))
{
$res = da_sql_query($link,$config,"INSERT INTO $table ($query_key,attribute,value $text2) VALUES ('$login','$sql_attr','$val' $op_val2);");
}
 
if (!$res || !da_sql_affected_rows($link,$res,$config))
echo "<b>Change failed for attribute $key: " . da_sql_error($link,$config) . "</b><br>\n";
$old_val = $item_vals["$key"][$j];
$old_val = da_sql_escape_string($link, $old_val);
$res = da_sql_query($link,$config,
"UPDATE $table SET value = '$val' WHERE $query_key = '$login' AND
attribute = '$sql_attr' AND value = '$old_val';");
// if attribute does not exist, we create it.
if (!$res || !da_sql_affected_rows($link,$res,$config))
$res = da_sql_query($link,$config,"INSERT INTO $table ($query_key,attribute,value $text2) VALUES ('$login','$sql_attr','$val' $op_val2);");
if (!$res || !da_sql_affected_rows($link,$res,$config))
echo "<b>Change failed for attribute $key: " . da_sql_error($link,$config) . "</b><br>\n";
}
else
{
#if value is empty, we delete this attribute
$old_val = $item_vals["$key"][$j];
$old_val = da_sql_escape_string($link, $old_val);
if(isset($old_val) && $old_val != '')
{
else{
// if value is empty, we delete this attribute
$old_val = $item_vals["$key"][$j];
$old_val = da_sql_escape_string($link, $old_val);
if(isset($old_val) && $old_val != '')
$res = da_sql_query($link,$config,"DELETE FROM $table WHERE $query_key = '$login' AND attribute = '$sql_attr' AND value = '$old_val';");
}
}
}
}