I need to delete a value from a database field separated by commas and re-enter again.
With PHP's str_replace function, I can delete all but the first or last, since there is always a comma left over. I'm testing the end function of PHP, but I appreciate any solution.
$referenciaDel; // 44
$referencia; // 44,45,46
$replace = str_replace(",".$referenciaDel,"",$referencia);
If it is the first value to be deleted it does not work because I added the comma in the function, and the first value has no comma before.