$sql = "UPDATE $table_posts SET post_parent_id=$post_parent_id_of_deleted_post WHERE post_parent_id=$post_id AND thread_id=$thread_id_of_deleted_post AND forum_id=$forum_if_of_deleted_post;";
api_sql_query($sql);
Database::query($sql);
$sql="DELETE FROM $table_posts WHERE post_id='".Database::escape_string($post_id)."'"; // note: this has to be a recursive function that deletes all of the posts in this block.
api_sql_query($sql);
Database::query($sql);
//delete attachment file about this post id
delete_attachment($post_id);
@ -734,13 +734,13 @@ function delete_post($post_id) {
$sql = "DELETE FROM $tbl_user_rel_user WHERE user_id = '{$row['user_id']}' AND friend_user_id = $hr_dept_id AND relation_type = '".USER_RELATION_TYPE_RRHH."' ";
$sql='SELECT path_certificate FROM '.$table_certificate.' WHERE cat_id="'.Database::escape_string($cat_id).'" AND user_id="'.Database::escape_string($user_id).'" ';
$rs=Database::query($sql,__FILE__,__LINE__);
$rs=Database::query($sql);
$row=Database::fetch_array($rs);
if ($row['path_certificate']=='' || is_null($row['path_certificate'])) {
$sql='SELECT * FROM '.$tbl_grade_certificate.' WHERE cat_id= (SELECT id FROM '.$tbl_grade_category.' WHERE course_code = "'.Database::escape_string($course_code).'" ) AND user_id="'.Database::escape_string($user_id).'" ';
$rs = Database::query($sql,__FILE__,__LINE__);
$rs = Database::query($sql);
$row= Database::fetch_array($rs);
if (Database::num_rows($rs) > 0)
return $row;
@ -3235,7 +3235,7 @@ class UserManager
$sql= "SELECT tc.path_certificate,tc.cat_id,tgc.course_code,tgc.name FROM $table_certificate tc, $table_gradebook_category tgc
WHERE tgc.id = tc.cat_id AND tc.user_id='$user_id' ORDER BY tc.date_certificate DESC limit 5";
@ -263,7 +263,7 @@ foreach($course_list as $current_course ) {
/*
$sql_last_attempt='SELECT exe_id FROM '.$tbl_stats_exercices.' WHERE exe_exo_id="'.$a_exercices['id'].'" AND exe_user_id="'.$current_student_id.'" AND exe_cours_id="'.$current_course['code'].'" ORDER BY exe_date DESC LIMIT 1';