$url, 'id_user' => $config['id_user'], ], ['*'] ); $res = false; $action = ''; if ($exist !== false) { $res = db_process_sql_delete( 'tfavmenu_user', [ 'url' => $url, 'id_user' => $config['id_user'], ] ); $action = 'delete'; } else { $res = db_process_sql_insert( 'tfavmenu_user', [ 'id_element' => $id_element, 'url' => $url, 'label' => $label, 'section' => $section, 'id_user' => $id_user, ] ); $action = 'create'; } if ($res !== false) { echo json_encode(['success' => true, 'action' => $action]); } else { echo json_encode(['success' => false, 'action' => $action]); }