gpt4 book ai didi

php - 在mysql表的列中按其位置(以逗号分隔)一次删除一个值

转载 作者:行者123 更新时间:2023-11-29 10:55:35 25 4
gpt4 key购买 nike

This is table that has all the skills which candidate can add to their profile in candidate table

And this is where candidate has added desired skills which is separated by comma,

现在我陷入困境,问题是我如何删除那些我不想再出现在我的个人资料中的技能。这是用逗号分隔的,这就是为什么我发现它单独删除

$sql_r = "select expert_skills, inter_skills, beginner_skills 
from user_personal_details
WHERE upd_user_id = '". $_SESSION["user_id"] ."'";

$skills_render = $this->model->execute_query_all($sql_r);


$arr1=explode(",",$skills_render['0']['expert_skills']);

$ty = array_keys($arr1);
$ty1 = array_values($arr1);

$location = $_POST['skill_location'];

echo $location;

$location 变量,即技能 ID,我从前端获取,如何按位置删除

最佳答案

您可以使用 array_diff( [3, 2, 1, 5], [2] ) 将得到 [3, 1, 5]

关于php - 在mysql表的列中按其位置(以逗号分隔)一次删除一个值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43091187/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com