if ($description['description_id'] >= ADD_BLOCK) {
if ($description['edit']=='1') {
$sql = "UPDATE $tbl_course_description SET title = '".Database::escape_string(Security::remove_XSS($title))."', content = '".Database::escape_string(Security::remove_XSS($content))."' WHERE id = '".$description_id."' ";
api_sql_query($sql, __FILE__, __LINE__);
} else {
if ($description['add']=='1') { //if this element has been submitted for addition
$sql = "INSERT IGNORE INTO $tbl_course_description SET id = '".$description_id."', title = '".Database::escape_string(Security::remove_XSS($title))."', content = '".Database::escape_string(Security::remove_XSS($content))."'";
api_sql_query($sql, __FILE__, __LINE__);
} else {
$sql = "UPDATE $tbl_course_description SET title = '".Database::escape_string(Security::remove_XSS($title))."', content = '".Database::escape_string(Security::remove_XSS($content))."' WHERE id = '".$description_id."' ";
api_sql_query($sql, __FILE__, __LINE__);
}
/*$sql = "SELECT id FROM $tbl_course_description WHERE id = ".ADD_BLOCK;
$sqlins = "INSERT INTO $tbl_course_description SET id = '".$description_id."', title = '".Database::escape_string($title)."', content = '".Database::escape_string($content)."'";
api_sql_query($sqlins, __FILE__, __LINE__);*/
} else {
//if title is not editable, then use default title
if (!$default_description_title_editable[$description_id]) {
$sql = "DELETE FROM $tbl_course_description WHERE id = '".$description_id."'";
api_sql_query($sql, __FILE__, __LINE__);
$sql = "INSERT IGNORE INTO $tbl_course_description SET id = '".$description_id."', title = '".Database::escape_string(Security::remove_XSS($title))."', content = '".Database::escape_string(Security::remove_XSS($content))."'";
$sql = "INSERT INTO $tbl_course_description SET id = '".$description_id."', title = '".Database::escape_string(Security::remove_XSS($title))."', content = '".Database::escape_string(Security::remove_XSS($content))."'";