0
I need to delete a value from a comma-separated database field and reinsert again.
With the function str_replace PHP can delete all but the first or last one, because there is always a comma left. I am testing the function end PHP, more thank you 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.
Does that number come from a link? just a number or it comes like this
43,45
?– rray
A single string comes from the database field (all together) @rray
– denis