fix, mysql error: Field 'is_global' doesn't have a default value

This commit is contained in:
Jaiver Pastor 2020-05-08 16:54:32 +02:00
parent e3e099680c
commit f8142218ef

View File

@ -438,16 +438,15 @@ function WriteConfigValue($szPropName, $is_global = true, $userid = false, $grou
if ( !isset($rows) ) if ( !isset($rows) )
{ {
// New Entry // New Entry
$result = DB_Query("INSERT INTO `" . DB_CONFIG . "` (propname, propvalue, userid) VALUES ( '" . $szPropName . "', '" . $szDbValue . "', " . $userid . ")"); $sql_query = sprintf("INSERT INTO `%s` (propname, propvalue, userid, is_global) VALUES ( '%s', '%s', %d, %d )", DB_CONFIG, $szPropName, $szDbValue, $userid, ($is_global ? 1 : 0) );
DB_FreeQuery($result);
} }
else else
{ {
// Update Entry // Update Entry
$result = DB_Query("UPDATE `" . DB_CONFIG . "` SET propvalue = '" . $szDbValue . "' WHERE propname = '" . $szPropName . "' AND userid = " . $userid); $sql_query = sprintf("UPDATE `%s` SET propvalue = '%s' WHERE propname = '%s' AND userid = %d", DB_CONFIG, $szDbValue, $szPropName, $userid);
DB_FreeQuery($result);
} }
$result = DB_Query($sql_query);
DB_FreeQuery($result);
} }
else if ( $groupid != false ) else if ( $groupid != false )
DieWithFriendlyErrorMsg( "Critical Error occured in WriteConfigValue, writing GROUP specific properties is not supported yet!" ); DieWithFriendlyErrorMsg( "Critical Error occured in WriteConfigValue, writing GROUP specific properties is not supported yet!" );